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

  • SEARCH
  • Home
  • 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'm trying to build my first generic list and have run into some problems.
I'm trying to build firefox but I'm having some problems. I currently have Visual
I'm trying to build an application from source in windows that requires some Unix
I'm trying to build a CompositeControl that's flexible. Depending on some of it's parameters,
I have a MacBook Pro that I'm trying to do some development on. I
I am finishing off a C# ASP.NET program that allows the user to build
I am trying to build a small applet that provides some 3d functionality into
i m trying to build an invoice program that holds data in an Access
So, I'm trying to build up a program with MATLAB according to some indications
I have to build a program that will allow me to track from a

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.