Testing server sockets

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
skindoc4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Mon Jul 07, 2008 1:22 am

Testing server sockets

Post by skindoc4 » Sun Aug 08, 2010 12:11 pm

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

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Testing server sockets

Post by bangkok » Sun Aug 08, 2010 2:17 pm

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

skindoc4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Mon Jul 07, 2008 1:22 am

Re: Testing server sockets

Post by skindoc4 » Mon Aug 09, 2010 1:29 am

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

Post Reply