Socket Communication Question (followup)

J

James Willans

James said:
If there is a more appropriate newsgroup to place this message then
please point me in the right direction.

We have an application that has a server and a number of clients
communicating using sockets. The java.nio libraries are used in the
server and java.io libraries are used in the clients (this may not be
relevant). We are currently testing our application on a windows
machine. All works fine until the status of the network changes, for
example if a wireless signal is momentarily lost the read and write
data methods begin throwing exceptions. I'm having trouble
determining whether or not the network disconnection is causing the
socket to be lost, or whether it is simple unavailable while the
network sorts itself out. In the case of the former, is the usual
strategy to simply handle the disconnection by recreating the socket?
In the case of the former, should I be performing checks prior to
check whether it is an unstable state? Any further information would
be much appreciated.

Steve, Thanks for your response:
A "momentary" interruption should not cause problems. Maybe it is
incovering bugs in your code.

It might be a bug in the code, this is what I need to try and
establish. First I need to understand better what the expected
behaviour would be. Should the loss of a wireless network signal and
hence the disconnection of the network for a few seconds cause sockets
running on that network to be lost?
What sort of exceptions?

The exception being reported is:

java.io.IOException: An existing connection was forcibly closed by the
remote host (I can repeat this error by pulling out the network cable
of the machine).

In the first instance I need to known what is expected here. If it is
the case that the socket actually persists through the interruption,
should I be (on the server) predicating the SocketChannel.write(..) to
check the status of the socket? Similarly on the client side should I
predicate the PrintStream.println(..)? If so, how?

Any help is much appreciated?

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top