powered by Jive Software

MSN Transport bombs out on "Ping"


I’'m in the process of writing a chat app. It uses smack to talk to openfire as a way to get users on my system talking on their msn/aim/etc using the gateway plugin.

We’'re using smack 3, and openfire 3.3.

openfire times users out after 6 minutes of being idle. (http://www.igniterealtime.org/issues/browse/JM-1019).

It is perfectly feasible that my users will idle for any length of time, so as a way to remedy this i added a “ping” method to my code. Every 2.5minute my code sends out a Presence stanza of Available. After two such pings MSN disconnects the user with the following message

2007.06.03 08:58:27 session 19 caught exception java.io.IOException: Connection reset by peer

2007.06.03 08:58:27 MSN: Exception occurred for dayjah@hotmail.co.uk : java.io.IOException: Connection reset by peer

2007.06.03 08:58:27 MSN: IO error: java.io.IOException: Connection reset by peer

2007.06.03 08:58:27 msn: Sending packet:

I tried with AIM, no such issue.

So it would seem MSN have some sort of limit on the number of bad stanza’'s they support?

Regardless of the actual issue in the gateway plugin what is the recommended way to ping openfire to keep the session active?


So I seem to have fixed this, though I do not really understand why it is a fix.

My presence ping was being sent from smack like this:

Presence ping = new Presence(Presence.Type.available);


That form would cause the IOException in the gateway plugin after the second ping. I just changed it to:

Presence ping = new Presence(Presence.Type.available, “”, 0, Presence.Mode.available);


and ive been happily pinging away for long time now.


I don’‘t actually know why that would be making a difference. I’'ll write up a quick little test to see if I can duplicate it.

Note that that issue you quoted is closed/fixed. ;D If you don’‘t mind tweaking your server though, you might actually want to try just setting the idle timeout on your server to something larger. xmpp.client.idle is the system property. It’'s mentioned here: http://wiki.igniterealtime.org/display/WILDFIRE/Wildfire+Properties

It’'s time is in milliseconds. But note that if you -really- want to ditch the idle you can just set it to -1 and disable idle timeouts altogether. =)

You shouldn’'t get disconnected from MSN or any of them as all of the various transports handle not timing out on their own. (MSN sends regular PNG commands … ping of course … you can actually watch them go by if you activate the debug log =) )

I can’'t seem to duplicate the behavior you were seeing unfortunately. =( I was even sending pings every 2 seconds instead of 2 minutes.

oh well - put it on a post-it note and stick it to your screen

having now had that “hack” in there for a fairly long time we’'ve not seen any of the logout issues.

I have a plan that I’'m aiming to work on at some point that may alleviate this problem a bit. That said, I have never been able to duplicate it as I said before. =) I take it you are still seeing it?


I’'ve not tested this without the status string for a while (I tend to not want to break the product once I have it working )

I can certainly test this for you if you want?


Well, I’'m always a fan of closure. lol Would you mind?

Sure thing - will add it to my list of things to do .

Update tonight.

Hey - seems the bombing out doesn’‘t happen anymore. i’'m using gateway 1.1.0 beta 1.


Awesome, thanks!