Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:06:09+00:00 2026-05-31T04:06:09+00:00

I am trying to build some program that detects if a server of some

  • 0

I am trying to build some program that detects if a server of some game is on or off, I have the IP and the port of the server.

What do I have to do to detect whether the server is on or off? Sockets? Ping class?

It would be nice if you guys could give me a code sample or something.

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:06:10+00:00Added an answer on May 31, 2026 at 4:06 am

    See Socket.Connect

    public static void Connect1(string host, int port)
    {
        IPAddress[] IPs = Dns.GetHostAddresses(host);
    
        Socket s = new Socket(AddressFamily.InterNetwork,
            SocketType.Stream,
            ProtocolType.Tcp);
    
        Console.WriteLine("Establishing Connection to {0}", 
            host);
        s.Connect(IPs[0], port); // Catch any exceptions here.
        Console.WriteLine("Connection established");
    }   
    

    By pinging a server you can get an indication whether the server is ‘on’ or ‘off’; it doesn’t give an indication whether the service you’re trying to connect to is running or not.

    if the first option is what you’re looking for (a general idea whether the server is on&connected to the internet), pinging will suffice for this task.

    As per the efficiency – pinging is more efficient (well, in large scale terms) as only 2 packets are being exchanged between the server and the client, rather than a full connection establishment which is about 3 packets –
    See TCP 3-Way handshake

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build some sort of a javascript antivirus that would try
I'm trying to build firefox but I'm having some problems. I currently have Visual
I was trying to build a very simple program in C that returns a
Background I am trying to build a Java program that make use of an
I have a MacBook Pro that I'm trying to do some development on. I
I am trying to build a program in python that relies on multiple threads,
I am trying to build a small applet that provides some 3d functionality into
i have been trying to create a little java program that all it does
I have a python program I wrote that I am trying to compile with
i m trying to build an invoice program that holds data in an Access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.