• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

java.net.SocketException: Connection reset

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 38
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 159
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shouldn't the client connect to the same port as the serversocket is listening on?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic