Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How can I poll a remote server, to see if it is still available?

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    32
    My Mood
    Worried
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How can I poll a remote server, to see if it is still available?

    Dear all

    Please help me for that How can I poll a remote server, to see if it is still available with a specified example.

    Thanks

    Regards
    Allena

    [/URL]
    Last edited by copeg; December 13th, 2011 at 09:44 AM.


  2. #2
    Member
    Join Date
    Nov 2011
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: How can I poll a remote server, to see if it is still available?

    Generally you can send a "ping" command to the server.
    If you want to check if the server listens on a specific port, you need to initiates a socket connection at the specified port. Google "Java socket example" would help you.

    Spring 3
    Last edited by cafeteria84; January 22nd, 2012 at 04:05 PM.

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: How can I poll a remote server, to see if it is still available?

    IMO, the best way to handle remote servers is to assume they are available and handle any exceptions which may occur if they are not. It's impossible to tell if between the time you ask the server if it's still there and the time you actually want to connect if the server had somehow died. Also, it adds unnecessary overhead to every request if you're asking if it's available first.

Similar Threads

  1. Java Code to connect remote server
    By idealguy in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 3rd, 2012, 04:59 AM
  2. How to connect to a remote database?
    By ace84 in forum JDBC & Databases
    Replies: 4
    Last Post: February 24th, 2011, 02:09 AM
  3. MAC of a remote host
    By Ansila Naushad M in forum Java Networking
    Replies: 2
    Last Post: January 27th, 2011, 05:57 AM
  4. Remote Installation
    By manshi in forum Java SE APIs
    Replies: 3
    Last Post: November 2nd, 2010, 05:52 AM
  5. remote system shutdown
    By prince joseph in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 28th, 2010, 02:35 AM