Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella Development Discussion For general discussion about Gnutella development.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old December 20th, 2002
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
  #2 (permalink)  
Old December 23rd, 2002
Connoisseur
 
Join Date: August 9th, 2001
Location: Philadelphia, PA, USA
Posts: 358
cultiv8r is flying high
Default

Are you checking the result for write() before you do a flush()? Also, I think that if you try to write zero bytes, it'll give the same error message (ie, you didn't check the result for read() )
Reply With Quote
  #3 (permalink)  
Old December 24th, 2002
Apprentice
 
Join Date: December 19th, 2002
Location: Canada
Posts: 5
lut321 is flying high
Default

Hi,
Thank you Cultiv8r for your reply. I will check if I am trying to write 0 byte. But i am not sure how can I check the result for write(). this method returns void.
Thanks.
Lu
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
question about java version jay173 General Windows Support 1 September 4th, 2006 06:27 AM
Question On Java Carlwill General Linux Support 2 July 26th, 2006 07:29 AM
java question chrisstewart Windows 2 February 3rd, 2006 04:44 PM
Stupid Question But..... Java Darylf General Linux Support 1 December 19th, 2002 06:28 PM
Install and general Java question Hummer General Linux Support 0 August 1st, 2001 04:13 AM


All times are GMT -7. The time now is 01:47 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.