Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > Re: SocketExcep...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 9 Topic 15784 of 16590
Post > Topic >>

Re: SocketException: Unable to find reason

by Lothar Kimmeringer <news200709@[EMAIL PROTECTED] > Feb 16, 2008 at 12:46 AM

Ravi wrote:

> http://pastebin.com/m24efe449
> 
> In the above code I am unable to find why I get SocketException
> whenever I run the DateClient? I also tried remove sock.close() from
> DateServer.java, but still no help.

Still there is a stacktrace missing, but one thing. A PrintWriter
might be buffered, so writing to it and closing the underlying
socket can lead to the effect, that no data runs the wire.

The client tries to read from the InputStream but because of the
closing socket this try will lead to an exception (something
like "connection reset by peer" or similar).

Better flush() the writer/stream and/or close the stream before
closing the socket.


Regards, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@[EMAIL PROTECTED]
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!
 




 9 Posts in Topic:
Re: SocketException: Unable to find reason
Lothar Kimmeringer <ne  2008-02-16 00:46:01 
Re: SocketException: Unable to find reason
Lew <lew@[EMAIL PROTEC  2008-02-15 20:26:44 
Re: SocketException: Unable to find reason
Daniele Futtorovic <da  2008-02-16 02:33:38 
Re: SocketException: Unable to find reason
Lew <lew@[EMAIL PROTEC  2008-02-15 21:00:58 
Re: SocketException: Unable to find reason
Daniele Futtorovic <da  2008-02-16 03:10:52 
Re: SocketException: Unable to find reason
Lew <lew@[EMAIL PROTEC  2008-02-15 22:38:19 
Re: SocketException: Unable to find reason
Daniele Futtorovic <da  2008-02-16 05:00:17 
Re: SocketException: Unable to find reason
Daniele Futtorovic <da  2008-02-16 05:06:41 
Re: SocketException: Unable to find reason
Lothar Kimmeringer <ne  2008-02-17 21:24:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 21:22:24 CST 2008.