Author | Topic: check physical connection between server and client | |
---|---|---|
Christin Paulick | check physical connection between server and client on Fri, 16 Mar 2007 08:40:30 +0100 Hello, how can I check if the connection between the server and client is still alive? If the client finished the connection (through finishing the software) I get an error but if the physical connection is broken I get only one error for the client or the server. Either the server quit the connection because it gets an error. But the client still hang in the socketrecv() and doesn't know that the connection is broken and I can only quit them about the task manager. Or the client get an error because the sending fails. But then the server hangs in the socketrecv(). Did anybody have an idea how I can control this ? Christin | |
Phil Ide | Re: check physical connection between server and client on Fri, 16 Mar 2007 11:03:40 +0000 Christin, > Either the server quit the connection because it gets an error. But the > client still > hang in the socketrecv() and doesn't know that the connection is broken > and I can only quit > them about the task manager. > > Or the client get an error because the sending fails. But then the > server hangs in the > socketrecv(). > > Did anybody have an idea how I can control this ? You have 2 options here. One is to use Xb2.NET which has better ability to detect broken connections, or you can set the socket into a mode whereby it sends events to a Window. When in event-driven mode, you do NOT enter a SocketRecv() call until your window recieves a message saying there is data waiting in the socket. In your event loop, you will also receive error events such as connection broken etc. allowing you to respond to such events. If you have the Platform SDK from Microsoft, a quick look at the section on socket programming will show how to setup for event-driven sockets. If you need further help with this, don't hesitate to ask. Regards, Phil Ide --------------------- www.xbhcl.com www.pbih.eu www.idep.org.uk/xbase --------------------- Tagline, You're it! |