I wonder if someone on the forum can point me in the right direction.
I have written a client server database application using sockets. I have found that for one reason or another, a client connection may close but the socket remains open on the server side. Attempts by the client to re-establish a connection are then seemingly blocked.
Is there a way for the server to test its open sockets to see if they are still valid and to close them if there is no active client connection?
Alex
Testing server sockets
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Testing server sockets
I think it would be better to invert the logic, AKA to close the socket on the client side after each query sent to / answer received from the server.
You'll find a example with a duo of stacks here :
http://forums.runrev.com/phpBB2/downloa ... php?id=128
You'll find a example with a duo of stacks here :
http://forums.runrev.com/phpBB2/downloa ... php?id=128
Re: Testing server sockets
Yes I do that routinely but sometimes the message from the client to the server is lost so the socket closes on the client side but remains open on the server side. There is then no way that I can work out to get the client reconnected to the server using the same port. Another option might be to use a different port using a new connection to kill the original server socket - might try this but I was hoping for something more elegant from the server side.
alex
alex