PDA

View Full Version : QSocket - signal for network wire disconnection



manivannan_1984
2nd September 2006, 07:53
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

jacek
2nd September 2006, 11:53
There is no way to find out whether the network is down, except for trying to send something.

ball
2nd September 2006, 17:03
You can send heart beat socket signal periodically, to check if any side is disconnected.

wysota
3rd September 2006, 02:01
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.

ball
3rd September 2006, 07:42
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.

wysota
3rd September 2006, 09:40
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 :)

Valheru
4th September 2006, 22:14
If you are using Linux, the ifplugd library will let you check if a network cable is unplugged or not.

manivannan_1984
5th September 2006, 14:52
Thanks for your replies...

Yes. I need to follow only the way what Jacek said....