• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

restarting and stopping serversocket running on port

Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I have a client server methodology in which I am using java ServerSocket connection to act as a server which will always looking for client request. This server will be running in a specified port like 4444, 4445,etc..,. I don't know how to stop that server because I am unable to take the ServerSocket instance running on port. So to achieve server stopping, I used to kill the process abruptly but this is not a proper way of stopping the server the server since my server is handling N number client requests concurrently and middle of the process if I kill this, tasks which is being handled by all the threads will go off. I am using ArrayBlockingQueue for queuing up the client requests. currently I am having 100 of Max thread pool size. Can any one help me out regarding this?

Sample piece of code:

to start the server :

Server code:

Please help me to stop the server by giving running port number. My applicaiton is running in sun solaris server.

Thanks in advance,

    Bookmark Topic Watch Topic
  • New Topic