• Post Reply Bookmark Topic Watch Topic
  • New Topic

to find socket alive

 
palanikumar gurusamy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when Server is closed, write() method of java.net.Socket class is not throwing IO Exception while writing bytes.
How can I find a Socket is alive before sending request?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't find out if the socket on the other end is still there without trying to send data. Socket doesn't have a write method, you write to a OutputStream - if that stream is buffered, it may not try to send until you do a flush().
Bill
 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Sockets and Internet Protocols forum

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!