QSocket - signal for network wire disconnection
HI All,
I developing a Instant Messaging System in QT3.3.4. I am using QSocket claases.
When the network wire has been disconnected or network connection is down.... I want to trigger a signal to all the online users..... Using socker I am not able to get any signal when the network wire disconnected....
Can anybody help me to fix this .....
Thanks..
Regards,
Mani
Re: QSocket - signal for network wire disconnection
There is no way to find out whether the network is down, except for trying to send something.
Re: QSocket - signal for network wire disconnection
You can send heart beat socket signal periodically, to check if any side is disconnected.
Re: QSocket - signal for network wire disconnection
Quote:
Originally Posted by ball
You can send heart beat socket signal periodically, to check if any side is disconnected.
But it won't tell you the cause of connection failure. Someone might have pulled the plug somewhere along the route. The abstraction of "connect state" (in regard to Transport Control Protocol) doesn't allow any notification whatsoever. The "connection" is purely virtual.
The only possibility I see to obtain information about a network interface being turned off is to use a platform specific API for querying the operating system about it. Of course it would only work on the host that dropped the interface and not on its peer.
Re: QSocket - signal for network wire disconnection
There are many ways to simulate a socket that not reporting the disconnection, but actually it is disconnected. Only logically (programmatically) using heart beat is reliable.
Re: QSocket - signal for network wire disconnection
Quote:
Originally Posted by ball
There are many ways to simulate a socket that not reporting the disconnection, but actually it is disconnected. Only logically (programmatically) using heart beat is reliable.
I think Jacek already said that :)
Re: QSocket - signal for network wire disconnection
If you are using Linux, the ifplugd library will let you check if a network cable is unplugged or not.
Re: QSocket - signal for network wire disconnection
Thanks for your replies...
Yes. I need to follow only the way what Jacek said....