Subject: Open() Method Retry
Hi,
I am making a presence client on a Smartphone using agsXMPP. If there is a socket error, I display a MessageBox on the phone telling the user there is a connection error and there are two options - Retry or Cancel.
If the user presses Retry, I just call my LogIn() function, which contains xmppCon.Open(). However, pressing this has never actually connected afterwards. I just continually get the socket error message. But if I quit the program and then restart, I can login as usual. My problem is not that I am getting a socket error, it's that Retry never seems to work. Is this because I need to have a timer and then try to reconnect after a certain amount of time has elapsed?
If the user presses Cancel, what should happen is nothing. However, what does happen is I get another socket error message, leading me to believe that the xmppCon.Open() method is trying to connect several times. What seems to happen is that it tries about 3 times to connect and then gives up. Even if I explicitly ask it to login again after the 3 times, it doesn't respond. Is there a way to change this? Or is this not supposed to be happening and it is something with my code?
Saying this, sometimes I also get many, many MessageBox messages saying there is a socket error (whether I press Retry or Cancel), and they appear very quickly (too quickly for me to close the program easily so sometimes I have to kill it). Surely this shouldn't be happening since I'm only asking the connection to be open once? Any ideas how can I prevent this?
Thanks for your help.
I am making a presence client on a Smartphone using agsXMPP. If there is a socket error, I display a MessageBox on the phone telling the user there is a connection error and there are two options - Retry or Cancel.
If the user presses Retry, I just call my LogIn() function, which contains xmppCon.Open(). However, pressing this has never actually connected afterwards. I just continually get the socket error message. But if I quit the program and then restart, I can login as usual. My problem is not that I am getting a socket error, it's that Retry never seems to work. Is this because I need to have a timer and then try to reconnect after a certain amount of time has elapsed?
If the user presses Cancel, what should happen is nothing. However, what does happen is I get another socket error message, leading me to believe that the xmppCon.Open() method is trying to connect several times. What seems to happen is that it tries about 3 times to connect and then gives up. Even if I explicitly ask it to login again after the 3 times, it doesn't respond. Is there a way to change this? Or is this not supposed to be happening and it is something with my code?
Saying this, sometimes I also get many, many MessageBox messages saying there is a socket error (whether I press Retry or Cancel), and they appear very quickly (too quickly for me to close the program easily so sometimes I have to kill it). Surely this shouldn't be happening since I'm only asking the connection to be open once? Any ideas how can I prevent this?
Thanks for your help.