Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: buzz nudge
I am trying to find the cause of my socket error. The symptom is that the PPC fails on a socket read and looses its IP address.

This happens after the application has been up and running for at least 5 minutes.

I have to narrow down wich is happening first. I expect it is loosing its IP address then throwing the socket read exception but I am not positive.

Question: What is the expected result of having keep alive true with a 120 second interval? Should this keep a PPC GPRS connection open?

Does anybody have any tips for establishing a network connection and keeping it open for agsxmpp to use?  I am using an opennetcf connection manager call to "dial" the Internet.

-Ayyrk
Avatar
ayyrk #2
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
(sorry about the topic - I was going to ask about buzz/nudge support but I have more looking around to do first)
Avatar
Alex #3
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #1
Quote by ayyrk:
Question: What is the expected result of having keep alive true with a 120 second interval? Should this keep a PPC GPRS connection open?

yes, this is for keeping connections alive. Some routers and other devices close connections if there is no traffic for a while which will shutdown your xmpp connection then.
You can disable the keep alives if you want.
The Keep alives are also good for discovering network errors like they do in your case. Because sometimes you don't get a disconnect when the socket gets closed by a peer/router etc... But if you try to send a packet on the broken socket you get the exception then.

Alex
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
addition:

ich you have to deal with network problems on pocket pcs, smartphones etc... then you  should also consider other transport layers than tcp/ip.
You can transport xmpp also over http with http polling or http binding (BOSH).

Alex
Avatar
ayyrk #5
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
With keep alive I am seeing ClientSocket_OnSend getting called with empty data every KeepAliveInterval. I assume this is the keepalive being issued.

Although the keepalive send is working the server sees the client as offline. It is as if the client socket can send without error but not receive. This could be a GPRS operator/carrier/network issue but I was thinking the keepalive would help here.

The result is this: I have clients that think they are online but are not. The server sees them as offline. The keepalive keeps sending without error. After 20 minutes in this state there is a socket error ( a read I presume ) that causes xmpp onClose to be called. Here I can restart the connection and the system heals.

The big problem is that it is taking around 20 minutes for the client to detect that the server connection has failed.

(I will experiment with HTTP client connections tonight - but the above is my experience with port 5222 )
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ayyrk:
With keep alive I am seeing ClientSocket_OnSend getting called with empty data every KeepAliveInterval. I assume this is the keepalive being issued.

yes, the keep alives sends only a space character which is a whitespace in XML and gets ignired between the XMPP stanzas

Quote by ayyrk:
Although the keepalive send is working the server sees the client as offline. It is as if the client socket can send without error but not receive. This could be a GPRS operator/carrier/network issue but I was thinking the keepalive would help here.

The result is this: I have clients that think they are online but are not. The server sees them as offline. The keepalive keeps sending without error. After 20 minutes in this state there is a socket error ( a read I presume ) that causes xmpp onClose to be called. Here I can restart the connection and the system heals.

The big problem is that it is taking around 20 minutes for the client to detect that the server connection has failed.

(I will experiment with HTTP client connections tonight - but the above is my experience with port 5222 )

yes its possible that a connection is broken in only one direction. But your scenario looks like a server problem to me. Because the server has to shutdown the socket in both directions if it detects the broken connection.

Alex
Avatar
ayyrk #7
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
More info:  I noticed that I can Quit Openfire server and still the agsxmpp clients can send keep alive messages without error.

Yes, the server is stopped and I continue to get socket send callbacks at each keep alive interval.
Avatar
Alex #8
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Make sure that you use the latest SVN code.
We made lots of tests and don't have such problems. Everything works fine here.

We can't test with GPRS connections. If this happens only on GPRS then please try to debug you code and agsXMPP and propose a patch.

Alex
Avatar
ayyrk #9
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Ok - I've got your code out of SVN. I can recompile but it won't link yet to my application. (my application being your miniclient code basically).

The errors are:

XmppCon.OnPresence += new agsXMPP.XmppClientConnection.PresenceHandler(XmppCon_OnPresence);
XmppCon.OnMessage += new agsXMPP.XmppClientConnection.MessageHandler(XmppCon_OnMessage);
XmppCon.OnIq += new StreamHandler(XmppCon_OnIq);

'PresenceHandler' does not exist in the type 'agsXMPP.XmppClientConnection'
'MessageHandler' does not exist in the type 'agsXMPP.XmppClientConnection'
Cannot implicitly convert type 'agsXMPP.Xml.StreamHandler' to 'agsXMPP.protocol.client.IqHandler'

Alex, if this is something obvious let me know otherwise please don't waste your time on it. I need to make sure I am rebuilding and setting my references correctly.

Thanks!
Avatar
ayyrk #10
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
In reply to post #8
Found this pretty quick and got the lastest SVN code running.. testing now. Thanks - sorry to waste time on this compile issue.


         

  XmppCon.OnPresence += new agsXMPP.protocol.client.PresenceHandler(XmppCon_OnPresence);

            XmppCon.OnMessage +=  new agsXMPP.protocol.client.MessageHandler(XmppCon_OnMessage);


            XmppCon.OnIq += new agsXMPP.protocol.client.IqHandler(XmppCon_OnIq);
Avatar
ayyrk #11
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
No luck so far sorting this out.   The MiniClientWM5 will stay connected, happily sending keep-alives and other messages, even after I stop the server.

Steps:
1) Connect with the devices ( I have more than one ) and send some messages.
2) Leave the device unattended and it will drop off the active session list on OpenFire.
3) Observe that the device continues sending keep-alives without error.
4) Stop OpenFire.
5) Observe that the device continues sending keep-alives without error.

The problem is that the device is offline but doesn't know it.

Windows Mobile 5 ( newish OS and radio firmware ) HTC Hermes.


I'm stuck.
Avatar
ayyrk #12
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Also - I tried sticking socket.poll and such in the agsxmpp svn code, I saw where it was commented out with explaination. The compact framework .net socket.poll just doesn't work as far as I can see.
Avatar
Jabberer #13
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Polling is supported for a very long time and works. Make sure your server also supports polling (eg. ejabberd).

here is a small smaple how to use it:
  1. Jid jid = new Jid(txtJid.Text);
  2. _connection.Server = jid.Server;
  3. _connection.Username = jid.User;
  4. _connection.Password = txtPassword.Text;
  5. _connection.Resource = txtResource.Text;
  6. _connection.Priority = (int) numPriority.Value;
  7. _connection.SocketConnectionType = agsXMPP.net.SocketConnectionType.HttpPolling;
  8. _connection.ConnectServer = "http://jabberes.org:5280/http-poll";

HTTP-Binding is in the lib but commented out because there is no server or component yet which supports it correctly according to the specs.
Software Developer
AG-Software
Avatar
ayyrk #14
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
I installed ejabberd.

Still using agsXMPP.net.SocketConnectionType.Direct

The same client code now handles disconnects much better. I still have more work to do but it seems like it is going to work now.

Alex, I should have tried another server earlier in the week when you first suggested it.
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: agsXMPP RSS