This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hi Help me

 
maha devan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am beginner in sockets. PLs help me in this

I wrote a client code that reads a txt file and sends it to the server.The server code prints the file until it reaches EOF String.
I am getting all the stuffs printed out ,but em getting a exception like this


StartedServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8090]
Connection AcceptedSocket[addr=/127.0.0.1,port=1074,localport=8090]
Echoing Stringojhejwk
Echoing Stringqkodjsjd
Echoing Stringkoqsjdosa;
Closing
Exception in thread "main" java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at Serversocket.main(Serversocket.java:19)
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch maha!

I might try to help if I could see the code, preferably properly indente, yes thank you.

Maybe you tried to close the socket while still a thread was blocked trying to read from it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic