Re: I want an event when program I'm connected with closes Socket

From: Esmond Pitt (esmond.pitt_at_not.bigpond.com)
Date: 01/13/05


Date: Thu, 13 Jan 2005 00:44:59 GMT

opalpa@gmail.com wrote:

> I've written socket code previously and am confronted with a new
> situation: I have a server which manages multiple connections and each
> connections can be reused for multiple messages. The client does not
> say anything before closing, it just closes. What is the correct way
> to determine that client closed socket?
>
> I've looked at java.net.socket 1.5 documentation and it is much too
> imprecise for my understanding. Like does isClosed() mean that close()
> was called on instance? Does it mean that specific symbols were
> received by instance from client?

isClosed tells you whether *you* have closed *your end*.

If the other end closes, a read will return -1 or an EOFException.



Relevant Pages

  • Re: Computer Name Change
    ... Shenan. ... any idea why the multiple connections message ... >> Windows XP Pro SP2 client. ... >@ECHO The syntax for this script is: ...
    (microsoft.public.windowsxp.general)
  • Re: how are multiple downloads of email messages prevented?
    ... I take it that the client has the responsibility for deciding when to ... download a message from the server. ... >> is a history of multiple connections to a POP server? ... >> I'm working with the ISP mail server folks to resolve the problem and am ...
    (microsoft.public.windowsxp.network_web)
  • Re: Running 2 client programs simultaneously
    ... So it's my server program problem that prevent the multiple connections ... all the client and server ... from accepting multiple connections from the same host (even from ...
    (comp.lang.perl.misc)
  • Re: P2P Application
    ... Server must accept multiple connections and client can start at any time. ... apply the power of opensource. ...
    (comp.unix.programmer)
  • Re: P2P Application
    ... I need an application which must act as client and server at the same time ... Server must accept multiple connections and client can start at any time. ...
    (comp.lang.c)