Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
HOW TO RECONNECT1
Avatar
rose5178 #1
Member since Mar 2008 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: HOW TO RECONNECT1
I put" xmppcon.open()" on "on_XMPPClose" event,to reconnect when network is interruptive.But sometime my client cannot reconnect.why?
Anyone can help me?   thanks!!
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Opening the connection again in the OnClose event is not a good idea.
You should start a timer in the OnClose event and Open the connection when the timer elapses. I would wait at least 10 seconds, otherwise you can run in race conditions and very fast connections attempts which is bad for every server software.

Alex
Alexander Gnauck
AG-Software
Avatar
rose5178 #3
Member since Mar 2008 · 14 posts
Group memberships: Members
Show profile · Link to this post
I do as you say,and stop timer in the On_login event ,but alse sometimes cannot reconnect.why?
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
check all error events. There must be a reason why reconnect fails

  • socket errors (no internet connection or server down)
  • server errors

Alex
Alexander Gnauck
AG-Software
Avatar
rose5178 #5
Member since Mar 2008 · 14 posts
Group memberships: Members
Show profile · Link to this post
I put off netcable from PC, and then put it on .

in XmppCon_OnError  event :        agsXMPP.Xml.InvalidTokenException

on     agsXMPP.Xml.xpnet.Encoding.tokenizeContent(Byte[] buf, Int32 off, Int32 end, ContentToken token)  ...\agsxmpp\Xml\xpnet\Encoding.cs:line 1867
on     agsXMPP.Xml.StreamParser.Push(Byte[] buf, Int32 offset, Int32 length) ...\agsxmpp\Xml\StreamParser.cs:line 137



in ClientSocket_OnError  event :  “System.Net.Sockets.Socket” is null,cannot visit.
                                  on        System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
                                  on        agsXMPP.net.ClientSocket.EndConnect(IAsyncResult ar) ...\agsxmpp\net\ClientSocket.cs:line262
This post was edited 2 times, last on 2008-08-15, 11:34 by rose5178.
Avatar
rose5178 #6
Member since Mar 2008 · 14 posts
Group memberships: Members
Show profile · Link to this post
Don't retruen IAsyncResult object.
on   System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
on  agsXMPP.net.ClientSocket.EndConnect(IAsyncResult ar) ...\agsxmpp\net\ClientSocket.cs:line 262

 attempt to connect  timeout.
Avatar
rose5178 #7
Member since Mar 2008 · 14 posts
Group memberships: Members
Show profile · Link to this post
What should I do?
Avatar
-glen- #8
Member since Sep 2009 · 16 posts
Group memberships: Members
Show profile · Link to this post
Subject: somewhat related to this problem
i had problem in reconnecting,if i am disconnected from the server(if no internet connection or accidentally pull off the cable)

i started a timer in onclose event, ill wait 10 seconds after the disconnection happens,and then reconnect again.10 sec. every failed reconnection.

i also get this error:

in XmppCon_OnError  event :        agsXMPP.Xml.InvalidTokenException

anyone experience this error?hope you can help me..

thanks in advance for all the 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: agsXMPP SDK Support RSS