Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what makes a socket close?  RSS feed

 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Having some trouble with a socket closing unexpectedly in my app. Would a timeout while waiting for a recieve packet make a socket close and throw a socketException ? I keep getting socketException messages and I don't know if this is maybe simply a timeout or another problem that I don't know about.
Any info apprciated!
Kim
 
Ryan Langley
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The socket will stay open until either the program exits or you call the close() method on the socket. This may be happening somewhere in your code, and you may not be realizing it. It can happen quite easily if you are using threads! Another problem could be that the socket port you are using may already be in use by the system. Make sure you are using a free port! Hope you find these suggestions helpful!
Cheers,
RL
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks RL! I appreciate your help very much. Will take a second look at things with that info.
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!