Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

server getting exited

 
vin Hari
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
iam using client server environment iam trying to connect client with server using TCP/IP using socket.it is working ,but my problem is that it isworking for only one client means it reads the contents of a single client as soon as client connects it reads and will execute for that client and dies soon, because of which iam not able to run multiple clients,please
help me how can make my server to live forever(until i dont explicitly close the server it should not die) please help me.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the server do after the client disconnects? Usually the server runs a loop that starts a new thread for each client that connects. So unless that loop is terminated for some reason, the server should continue to run.
 
vin Hari
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thank you for reply my code is something like this:


This is brief code regarding the server that iam using in between iam reading the contents of client and so on...and iam reading server port through command line.
i want after certain time the server should stop ,but here it is stopping immediately when the first client disconnects i tried with by making running flag always true,but it gives me not exact result apart from that suggest me some modification so that it should get exited after a particular time limit. thanks in advamce.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At server startup I'd save the current time, and then later on set runningFlag to false only if a sufficient amount of time has passed since the startup time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!