• Post Reply Bookmark Topic Watch Topic
  • New Topic

sockets and garbage collection ...  RSS feed

 
Pinda Ros
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have developed a server application that can accept one connection at a time. One of the server options is that the client can request to chat with the server.If this is the case, the the server opens a chat window which uses another class 'chatserver' in order to wait for and accept connection. However, i found out that if the user on the server closes the ChatGui of the server (maybe because they finished chatting) and they reopen it after about 4 minutes a bind exception will be thrown. After testing i found out that the Gui is disposed but the serversocket still waits and accepts connections while another gui opens and tries to bind the same port. i have a cleanup method that closes I/O streams and closes the serversocket and socket objects as well.
Does anyone have anyidea how to force the server socket release the specific port?
Thank you in advance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!