aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes  java.net.SocketException: Connection reset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark " java.net.SocketException: Connection reset" Watch " java.net.SocketException: Connection reset" New topic
Author

java.net.SocketException: Connection reset

mania mir
Greenhorn

Joined: Oct 08, 2013
Posts: 11
Hi,
I'm new at socket programming and threads. I'd be happy if anyone can help me out with this exception.

Two server sockets are running,
1) Control Server at port 10500, I have no problem in getting result from this server it returns "done#1#end#done#2#end#done#3#end#done#4#end#done#5#end" at line 67.
2) Transfer Server at port 10502, the socket exception occurs at the time of reading result from Transfer server at line 96.

And the Client Socket is running at localhost/10501.

At line 92, I've already checked if there is a client connection and the opening state of ControlServer/TransferServer.
But the inputstream (_inFromTransferServer) for reading the result from TransferServer is not ready. I wonder if that causes this exception?

That's the main():


That's the thread class:


That's the stacktrace of the exception:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream. java:196)
at java.net.SocketInputStream.read(SocketInputStream. java:122)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.j ava:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.ja va:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:1 77)
at java.io.InputStreamReader.read(InputStreamReader.j ava:184)
at java.io.BufferedReader.fill(BufferedReader.java:15 4)
at java.io.BufferedReader.read1(BufferedReader.java:2 05)
at java.io.BufferedReader.read(BufferedReader.java:27 9)
at java.io.Reader.read(Reader.java:140)
at ptolemy.domains.openmodelica.lib.omc.TransferServe r.run(TransferServer.java:216)
at ptolemy.domains.openmodelica.lib.OpenModelica.fire (OpenModelica.java:466)
at ptolemy.actor.sched.FixedPointDirector._fireActor( FixedPointDirector.java:808)
at ptolemy.actor.sched.FixedPointDirector.fire(FixedP ointDirector.java:241)
at ptolemy.domains.continuous.kernel.ContinuousDirect or.fire(ContinuousDirector.java:448)
at ptolemy.actor.CompositeActor.fire(CompositeActor.j ava:450)
at ptolemy.actor.CompositeActor.iterate(CompositeActo r.java:1089)
at ptolemy.actor.sched.StaticSchedulingDirector.fire( StaticSchedulingDirector.java:210)
at ptolemy.domains.sdf.kernel.SDFDirector.fire(SDFDir ector.java:492)
at ptolemy.actor.CompositeActor.fire(CompositeActor.j ava:450)
at ptolemy.actor.Manager.iterate(Manager.java:787)
at ptolemy.actor.Manager.execute(Manager.java:352)
at ptolemy.actor.Manager.run(Manager.java:1202)
at ptolemy.actor.Manager$PtolemyRunThread.run(Manager .java:1760)
Vivek SharmaJi
Ranch Hand

Joined: Dec 09, 2012
Posts: 38

There may be following issues.

The other end has deliberately reset the connection, in a way which I will not document here. It is rare, and generally incorrect, for application software to do this, but it is not unknown for commercial software.

More commonly, it is caused by writing to a connection that the other end has already closed normally. In other words an application protocol error.

In Windows, 'software caused connection abort', which is not the same as 'connection reset', is caused by network problems sending from your end.

Dennis Grimbergen
Ranch Hand

Joined: Nov 04, 2009
Posts: 138

Shouldn't the client connect to the same port as the serversocket is listening on?

SCJP, SCWCD, SCJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.net.SocketException: Connection reset
 
Similar Threads
De-Serialize object from Socket.
problem in checking net connection
I/O client server excercise
java.net.SocketException: Connection reset
java.net.SocketException: Connection reset