[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] Java Socket Question ..



On Mon, 8 Feb 1999, phil wrote:

: I have an applet that uses a standard socket (java.net.socket). that 
: connects to a unix server.
: I need to know how to determine when the server side hangs up. 
: 
: It is possible to determine if the socket has problems, by trying to 
: read from the input stream, if a EOF is received then I assume the socket 
: is closed.  However I dont want to periodically read from the input 
: stream, just to check whether the socket is up.  If I try this using 
: buffered data channel, I lose my position and everything that is waiting
: for to be read, after the check.

JDK1.1 has limited support for socket options. Unfortunately it does not
support SO_KEEPALIVE. Besides, you probably want 1.02 for an applet. I
would think the only way to test a connection is to try to send data
over the socket and wait for an acknowledgement. Since you can't use
SO_KEEPALIVE, you will have to build it into your network protocol.

If it sounds like too much trouble, you are probably right.

Ryan Heise                             http://www.progsoc.uts.edu.au/~rheise/
=============================================================================
main(){printf("%d != %d, why?\n", sizeof('"')["'"],(sizeof('"'))["]\"\0["]);}
=============================================================================

--
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.

This list is archived at <http://www.progsoc.uts.edu.au/lists/progsoc/>