• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

force close server socket while waits for connection

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have develoed 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic