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

How can i catch socket timeout when writing?  RSS feed

 
Mike Nightsky
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Server which has a collection of sockets. and some time when the socket times out, the writer thread hangs at this socket and is blocked. How can i prevent the blocking and just ignore this socket (and close and send it to hell)?
thanx
Mike
got root?
 
Brian Glodde
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you on Solaris? NT? Do you have all the latest patches?
 
Mike Nightsky
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm developing on a Win2k, target system is a Linux box and we are using jsdk1.4
[ April 19, 2002: Message edited by: Mike Nightsky ]
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YOu can generally set the timeout on a socket by using setSoTimeout(int).
This definitely works for checking timeouts when using read(), it may work for write() too
 
Brian Glodde
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I imagined that Mike already knew about setSoTimeout(). There were some problems with Solaris that were fixed with patches some time ago and it sounded like the same situation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!