Connection reset by peer
Posted on 1999-07-27
I try to write a client in java who shall communicate with a server written in c++. Port is 55301. The server echo back everything with :----: append to the data.
It works well if I use telnet but in java I get exception "Connection Reset by peer and "Socket closed" when I try to recieve previous message.
The message "Socket closed" is recieved first when the previous message have been rec. I think that the socket works due to the thread is blocking when it waits for a connection.
The javacode is in an applet.
Server is Linux (GNU c++), Apache server.
Client is Windows 98, Netscape Browser.
The Client in java is compiled with JDK and written with emacs.
A few lines of the code:
st = new Socket(ia, portData);
dis = new DataInputStream(st.getInputStream());
dos = new DataOutputStream(st.getOutputStream());
This code run in a separate Thread
String str = dis.readLine();
if(str == null) break;