[4891] in java-interest

home help back first fref pref prev next nref lref last post

Re: Beta2 changes socket.close() behaviour ?

daemon@ATHENA.MIT.EDU (Juerg Gertsch)
Thu Jan 18 14:55:19 1996

Date: Thu, 18 Jan 1996 16:13:16 +0100
From: gertsch@iam.unibe.ch (Juerg Gertsch)
To: java-interest-digest@java.sun.com

Hi everybody,
 
> > I have some simple client/server applications written in Java.  I was working
> > on a new one and noticed that when the server closes its socket, the client
> > doesn't notice this!  In Beta1, the client did notice (re-compiling code
> > that's identical except for beta2 required changes that don't effect this
> > issue, I think).
> > 
> > For example, a simple server that just echoes its input back to the client
> > (until the client types "quit"), exercised with telnet: on Beta1 when the
> > client types "quit", the server closes its socket and telnet reports the
> > connection to the server went away.  Compiled on beta2, it *doesn't* go
> > away... telnet think's it still attached, but the server thinks its closed
> > the socket (I've verified I *am* calling socket.close(), and the call
> > succeeds - no exception).
> > 
> > Has anyone else seen this?  It makes it kind of hard to know when the socket
Yes. I have the same problem.
The problem occurs only on Win95/NT with Beta2. socket.close() doesn't work correct (this was 
ok with Beta1)
Seems to be a problem in NET.DLL?!
On Solaris the problem doesn't exist.

Here an example, which reproduces the problem:

import java.lang.*;
import java.io.*;
import sun.net.*;

        
    public class MyNetworkServer extends NetworkServer {
        public void serviceRequest() {
            try {
                clientOutput.print("Hello");
                clientOutput.flush();
                clientSocket.close();
            } catch (IOException e) {System.out.println(e.toString());}
        }


        public static void main(String args[]) {
            MyNetworkServer server = new  MyNetworkServer();
            try {
                server.startServer(7008);
            } catch (IOException e) {System.out.println(e.toString());}
        }
    }

cheers
   Juerg

-----------------------------------------------------------------
Juerg Gertsch
Software Composition Group, University of Berne
<URL:http://iamwww.unibe.ch/~gertsch>
e-mail: gertsch@iam.unibe.ch
-----------------------------------------------------------------
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post