View Single Post
  #1 (permalink)  
Old December 20th, 2002
lut321 lut321 is offline
Apprentice
 
Join Date: December 19th, 2002
Location: Canada
Posts: 5
lut321 is flying high
Default Question about java.net.SocketException

Hi,
I am developing a Gnutella network Crawler in Java (version 1.4). To make sure that my crawler is healthy to the network, I am trying to make it behave exactly like a normal Gnutella client (responding to Ping, Pong, Query, Query Hit messages according to the protocol).
My program is working, but I think there are some bugs. When I forward messages, sometime it throws the following Exceptions:
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutp utStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStre am.java:136)
at java.io.DataOutputStream.write(DataOutputStream.ja va:85)
All I did for forwarding a message is to convert the message to byte array and call socket.getDataOutputStream.write(bytearray), then socket.getDataOutputStream.flush(); This send() method and any other methods that manipulate the socket are declared as synchronized. Before I actually call the write() and flush methods, i checked (socket!=null && !socket.closed() && !socket.isOutputClosed(). I spent a lot of time trying to debug, but didn't get anywhere.
I would really appreciate any comment and help.
Thanks,
Lu
Reply With Quote