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

restarting and stopping serversocket running on port  RSS feed

Ponnusamy Gov
Posts: 18
  • Mark post as helpful
  • send pies
  • 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,

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!