Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to detect a failed hardware connection?  RSS feed

 
Sumanth R Prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The situation is :
I'm trying to write something onto a socket.... during the process, the connection is lost ( cable is disconnected)... Is there anyway to detect the failure, by catching an exception?
Currently, i'm executing the write statements inside a try block and catching any exception which would be thrown.... but it's not throwing any exception and continuing to write as if the connection is still intact...
this is resulting in data loss....
Is there anyway to detect this and solve the problem???
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the inherent problems of a distributed computing. Your only defense is to buffer your data until you know it has been received.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!