Subject: Reconnect sample problem
Hello,
I have modified the reconnect sample to run 10 client in parallel.
The problem is that sometime some clients are looping on the reconnect timer when the first connection failed.
With the output i can see that the problem comes from an OnError event (ClientSocket Connection request failed)
1 second after the client who received the onError event receives an OnLoggin and an OnBind event.
5 second after the reconnect timer fires an try to open an already opened client. It fails and relanch a 5s timer to reconnect.
What is the best method to resolve this issue ?
The output of the program :
16:24:12 : 0 : connect: XMPP connecting....
16:24:12 : 1 : connect: XMPP connecting....
16:24:12 : 2 : connect: XMPP connecting....
16:24:12 : 3 : connect: XMPP connecting....
16:24:12 : 4 : connect: XMPP connecting....
16:24:12 : 5 : connect: XMPP connecting....
16:24:12 : 6 : connect: XMPP connecting....
16:24:12 : 7 : connect: XMPP connecting....
16:24:12 : 8 : connect: XMPP connecting....
16:24:12 : 9 : connect: XMPP connecting....
press any key to stop
16:24:12 : 5 : OnError: ClientSocket Connection request failed.
16:24:12 : 5 : starting reconnect timer...
16:24:12 : 8 : OnError: ClientSocket Connection request failed.
16:24:12 : 8 : starting reconnect timer...
16:24:12 : 9 : OnError: ClientSocket Connection request failed.
16:24:12 : 9 : starting reconnect timer...
16:24:13 : 6 : OnLogin
16:24:13 : 2 : OnLogin
16:24:13 : 0 : OnLogin
16:24:13 : 6 : OnBind: XMPP connected. JID: jabber01@e-i.net/other6 :
16:24:13 : 2 : OnBind: XMPP connected. JID: jabber01@e-i.net/other2 :
16:24:13 : 5 : OnLogin
16:24:13 : 0 : OnBind: XMPP connected. JID: jabber01@e-i.net/other0 :
16:24:13 : 7 : OnLogin
16:24:13 : 5 : OnBind: XMPP connected. JID: jabber01@e-i.net/other5 :
16:24:13 : 9 : OnLogin
16:24:13 : 7 : OnBind: XMPP connected. JID: jabber01@e-i.net/other7 :
16:24:13 : 4 : OnLogin
16:24:13 : 1 : OnLogin
16:24:13 : 3 : OnLogin
16:24:13 : 9 : OnBind: XMPP connected. JID: jabber01@e-i.net/other9 :
16:24:13 : 4 : OnBind: XMPP connected. JID: jabber01@e-i.net/other4 :
16:24:13 : 8 : OnLogin
16:24:13 : 3 : OnBind: XMPP connected. JID: jabber01@e-i.net/other3 :
16:24:14 : 1 : OnBind: XMPP connected. JID: jabber01@e-i.net/other1 :
16:24:14 : 8 : OnBind: XMPP connected. JID: jabber01@e-i.net/other8 :
16:24:17 : 5 : connect: XMPP connecting....
16:24:17 : 5 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 5 : starting reconnect timer...
16:24:17 : 8 : connect: XMPP connecting....
16:24:17 : 8 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 8 : starting reconnect timer...
16:24:17 : 9 : connect: XMPP connecting....
16:24:17 : 9 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 9 : starting reconnect timer...
16:24:22 : 5 : connect: XMPP connecting....
16:24:22 : 5 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 5 : starting reconnect timer...
16:24:22 : 8 : connect: XMPP connecting....
16:24:22 : 8 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 8 : starting reconnect timer...
16:24:22 : 9 : connect: XMPP connecting....
16:24:22 : 9 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 9 : starting reconnect timer...
I have joined the two modified files from the reconnect sample (ReconnectXmppWrapper.cs, Program.cs).
Thanks.
I have modified the reconnect sample to run 10 client in parallel.
The problem is that sometime some clients are looping on the reconnect timer when the first connection failed.
With the output i can see that the problem comes from an OnError event (ClientSocket Connection request failed)
1 second after the client who received the onError event receives an OnLoggin and an OnBind event.
5 second after the reconnect timer fires an try to open an already opened client. It fails and relanch a 5s timer to reconnect.
What is the best method to resolve this issue ?
The output of the program :
16:24:12 : 0 : connect: XMPP connecting....
16:24:12 : 1 : connect: XMPP connecting....
16:24:12 : 2 : connect: XMPP connecting....
16:24:12 : 3 : connect: XMPP connecting....
16:24:12 : 4 : connect: XMPP connecting....
16:24:12 : 5 : connect: XMPP connecting....
16:24:12 : 6 : connect: XMPP connecting....
16:24:12 : 7 : connect: XMPP connecting....
16:24:12 : 8 : connect: XMPP connecting....
16:24:12 : 9 : connect: XMPP connecting....
press any key to stop
16:24:12 : 5 : OnError: ClientSocket Connection request failed.
16:24:12 : 5 : starting reconnect timer...
16:24:12 : 8 : OnError: ClientSocket Connection request failed.
16:24:12 : 8 : starting reconnect timer...
16:24:12 : 9 : OnError: ClientSocket Connection request failed.
16:24:12 : 9 : starting reconnect timer...
16:24:13 : 6 : OnLogin
16:24:13 : 2 : OnLogin
16:24:13 : 0 : OnLogin
16:24:13 : 6 : OnBind: XMPP connected. JID: jabber01@e-i.net/other6 :
16:24:13 : 2 : OnBind: XMPP connected. JID: jabber01@e-i.net/other2 :
16:24:13 : 5 : OnLogin
16:24:13 : 0 : OnBind: XMPP connected. JID: jabber01@e-i.net/other0 :
16:24:13 : 7 : OnLogin
16:24:13 : 5 : OnBind: XMPP connected. JID: jabber01@e-i.net/other5 :
16:24:13 : 9 : OnLogin
16:24:13 : 7 : OnBind: XMPP connected. JID: jabber01@e-i.net/other7 :
16:24:13 : 4 : OnLogin
16:24:13 : 1 : OnLogin
16:24:13 : 3 : OnLogin
16:24:13 : 9 : OnBind: XMPP connected. JID: jabber01@e-i.net/other9 :
16:24:13 : 4 : OnBind: XMPP connected. JID: jabber01@e-i.net/other4 :
16:24:13 : 8 : OnLogin
16:24:13 : 3 : OnBind: XMPP connected. JID: jabber01@e-i.net/other3 :
16:24:14 : 1 : OnBind: XMPP connected. JID: jabber01@e-i.net/other1 :
16:24:14 : 8 : OnBind: XMPP connected. JID: jabber01@e-i.net/other8 :
16:24:17 : 5 : connect: XMPP connecting....
16:24:17 : 5 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 5 : starting reconnect timer...
16:24:17 : 8 : connect: XMPP connecting....
16:24:17 : 8 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 8 : starting reconnect timer...
16:24:17 : 9 : connect: XMPP connecting....
16:24:17 : 9 : OnError: The Open method cannot be called on an active stream.
16:24:17 : 9 : starting reconnect timer...
16:24:22 : 5 : connect: XMPP connecting....
16:24:22 : 5 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 5 : starting reconnect timer...
16:24:22 : 8 : connect: XMPP connecting....
16:24:22 : 8 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 8 : starting reconnect timer...
16:24:22 : 9 : connect: XMPP connecting....
16:24:22 : 9 : OnError: The Open method cannot be called on an active stream.
16:24:22 : 9 : starting reconnect timer...
I have joined the two modified files from the reconnect sample (ReconnectXmppWrapper.cs, Program.cs).
Thanks.