Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection reset by peer: socket write error  RSS feed

 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,


I am trying to make a connection with a server on a particular port and read & write data through this conenction. ALl goes well and I am able to make conenction & read & wrtie through this but while I am trying to run this program continuously it starts throwing error:

<b>Connection reset by peer: socket write error</b>

00:23:30 Exception: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:113)
at com.logica.smpp.TCPIPConnection.send(TCPIPConnection.java:353)
at com.logica.smpp.Transmitter.send(Transmitter.java:79)
at com.logica.smpp.Session.send(Session.java:993)
at com.logica.smpp.Session.send(Session.java:1048)
at com.logica.smpp.Session.enquireLink(Session.java:789)
at SmppReceive.enquireLink(SmppReceive.java:437)
at SmppReceive.receive(SmppReceive.java:538)
at SmppReceive.main(SmppReceive.java:169)

I tried finding on web but not much help. My questions are:

1. if this error means the connection is closed by the other end than what could be the probable causes?

2. Why it succeeded to make another connection same time?

3. If I tried to ping or telnet on the particular port why it shows communication while program show the above error.

Would be highly obliged if you could help me to understand the problem.

regards,
Arun
[ June 07, 2006: Message edited by: arun mahajan ]
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the problem is that your server is closing you socket in the server side.

It is not necessarily an error. It all depends on your server protocol.

I am sure your server is performing a task or service for you. Now, if the protocol of the server establishes that every service requires a new socket, after serving your socket it will close the communication, and wait for another task.

You must understand your server protocol, that is, the way you must format the information through the wire so that your server and your client understand each other. That might be the problem.

However, there is a chance that the server is actually closing your socket unexpectedly. Maybe the server side can offer you some logging information about why the socket was closed.

I hope this helps!
 
Faisal Ahmed Siddiqui
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should see the enquirelink option of your server
in my case..
i create a pool of connections from server.. and my thread send an enquire link PDU.. after every 30 second..
and it varies from carrier to carrier..
so i kept it paramterized.. in paramter file..
i hope it will help you out..
if you would like then we can discuss more online..
 
funny temp
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frineds,
I am facing the following exception when i try to stream the PDF document for the client. Please help me resolve the same. Thanks in advance

3ce82dd3 SRTServletRes E SRVE0120E: IO Error java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java(Compiled Code))
at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code))
at com.ibm.ws.io.Stream.write(Stream.java:26)
at com.ibm.ws.io.WriteStream.flushMyBuf(WriteStream.java(Inlined Compiled Code))
at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Inlined Compiled Code))
at com.ibm.ws.http.ResponseStream.flush(ResponseStream.java(Compiled Code))
at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Compiled Code))
at com.ibm.ws.webcontainer.http.HttpConnection.flush(HttpConnection.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.srp.SRPConnection.flush(SRPConnection.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.SRTOutputStream.flush(SRTOutputStream.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.BufferedServletOutputStream.flushBytes(BufferedServletOutputStream.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.BufferedServletOutputStream.flush(BufferedServletOutputStream.java:343)
at com.ibm.ws.webcontainer.srt.BufferedServletOutputStream.finish(BufferedServletOutputStream.java:169)
at com.ibm.ws.webcontainer.srt.BufferedServletOutputStream.close(BufferedServletOutputStream.java:433)
at com.ibm.ws.webcontainer.srt.SRTServletResponse.closeResponseOutput(SRTServletResponse.java:1344)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:245)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"funny temp", please check your private messages for an important administrative matter.
As Edwin wrote (three years ago), the problem is that the other end of the socket is terminating the connection. This is not necessarily an error.
 
Andrei Matyas
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've faced this issue and I think that you close the socket without reading all incoming data (read everything in your input stream even blank spaces). In TCP an RST signal is send if a socket is closed while received data is still pending in TCP stack. In this case the RST means data-loss.
 
Maulin Rathod
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible issue could be postdata limit set on webserver (apache/IIS).

Please check http://java-junction.blogspot.com/2010/04/httpclient-socketexception.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!