Does anyone know why the Close Event is not dispatched after I disconnect my wifi connection? Or any way to determine if the connection is active.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not sure you need to implicately close it but I do on the close callback
You can also test during connection time to make sure it is not already connected
[EDIT]
When connection is lost to the server a connection closed event will not fire, you have to test for this if you want to reconnect.
To do this you need to set up a timer to poll the connection. The following class will continue to pole the socket and if it is found not connected it will try to reconnect.
I stripped down and removed the send functions and non-relative info.
As you can see I have a timer that poles the socket and will also time out after so many retries.
This class will try to keep your socket alive if it gets closed.
Obviously you need to assign port and host.