Results 1 to 8 of 8

Thread: QSocket - signal for network wire disconnection

  1. #1
    Join Date
    Aug 2006
    Location
    banglore
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default 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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Jan 2006
    Posts
    75
    Thanks
    3
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSocket - signal for network wire disconnection

    You can send heart beat socket signal periodically, to check if any side is disconnected.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  5. #5
    Join Date
    Jan 2006
    Posts
    75
    Thanks
    3
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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

  7. #7
    Join Date
    Aug 2006
    Posts
    163
    Thanks
    12
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default 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.

  8. #8
    Join Date
    Aug 2006
    Location
    banglore
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QSocket - signal for network wire disconnection

    Thanks for your replies...

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.