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]
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.
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.
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.
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.