Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
matianyi #1
Member since Mar 2012 · 19 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: BOSH: can not detect disconnect when network cable is unplugged
My application uses bosh to connect to server.
When there is no operation on the client, matrix send empty request to server every 60s.
If I disable the network adapter, the OnClose event can be fired before inactivity time.
But if I unplugged the network cable from my computer, the OnClose event is never fired at all even after the inactivity time. Until someone trigger a event to send message to server actively. If there is no message sent to server, the OnClose is never fired, and the client is always online.

Is there anyway to let matrix dectect network disconnection when the network cable is unplugged.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
are you running the latest build of MatriX from here?
http://www.ag-software.net/download-directory/

If not please download the latest build first. We made lots of BOSH improvements in the latest versions.

Alex
Avatar
matianyi #3
Member since Mar 2012 · 19 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Thanks for your reply.

I try the Matrix.dll from the download-directory. and it remained same.

After the network cable is unplugged, there is no empty request sent. and the CreateWebRequest event is never fired again.

2012-12-27 10:22:57,870 [8] [DEBUG] XmppClientFactory BOSH_SEND:<body xmlns:xmpp="urn:xmpp:xbosh" xmlns:stream="http://etherx.jabber.org/streams" rid="1385822869" key="4b395dd521a6062e3e0d57cf5ed4f9b70d7627a0" sid="f7e8826a26344ec994e386901eab77d6" to="ts.co.jp" xmlns="http://jabber.org/protocol/httpbind" />
2012-12-27 10:23:57,958 [8] [DEBUG] XmppClientFactory BOSH_RECV:<body xmlns="http://jabber.org/protocol/httpbind"></body>
2012-12-27 10:23:58,348 [8] [DEBUG] XmppClientFactory BOSH_SEND:<body xmlns:xmpp="urn:xmpp:xbosh" xmlns:stream="http://etherx.jabber.org/streams" rid="1385822870" key="3544a917b05c350517ed56cb94e7c76cd019c602" sid="f7e8826a26344ec994e386901eab77d6" to="ts.co.jp" xmlns="http://jabber.org/protocol/httpbind" />
2012-12-27 10:24:58,952 [8] [DEBUG] XmppClientFactory BOSH_RECV:<body xmlns="http://jabber.org/protocol/httpbind"></body>
2012-12-27 10:24:59,072 [8] [DEBUG] XmppClientFactory BOSH_SEND:<body xmlns:xmpp="urn:xmpp:xbosh" xmlns:stream="http://etherx.jabber.org/streams" rid="1385822871" key="5a01e126ae30b978ef081501088230f0a977ec56" sid="f7e8826a26344ec994e386901eab77d6" to="ts.co.jp" xmlns="http://jabber.org/protocol/httpbind" />
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MatriX is based on .NETs HttpWebRequests classes for BOSH. The timeouts for WebRequests are very high by default. So it can take a very long time until MatriX gets forwarded the disconnect from .NET when plugging the cable.

You can try to modify some timeout values in OnCreateWebRequest  of the WebRequest and the ServicePoint. But our tests have shown that most of these values get ignored by .NET when long polling in HTTP is involved.

The best method to detect disconnects faster on BOSH is using a timer in your program which sends eg. a XMPP Ping packet to the server every X seconds. When you try to send the ping then MatriX creates a new webRequests which fails. Then it discovers the disconnect when the inactivity time which you configured on your server gets reached.

Alex
This post was edited on 2012-12-27, 18:44 by Alex.
Avatar
matianyi #5
Member since Mar 2012 · 19 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
The best method to detect disconnects faster on BOSH is using a timer in your program which sends eg. a XMPP Ping packet to the server every X seconds.

This method works.
Thanks for your reply.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS