About Store Forum Documentation Contact



Post Reply 
Connection timeout
Author Message
cmontiel Offline
Member

Post: #1
Connection timeout
On Android if you try to connect to a bad ip or port, function clientConnectToServer keeps waiting 3 or 4 minutes before return false, it stops game rendering, update, etc...

My proposal something like:

Bool clientConnectToServer(C SockAddr &server_addr, Flt timeout);

Then we can stop it after 5 secs for example.
(This post was last modified: 10-22-2013 09:06 PM by cmontiel.)
10-22-2013 09:05 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Connection timeout
I'm using system call 'connect' which is responsible for the delay and it has no timeout option, you should always call connect on secondary thread to avoid delays.

http://msdn.microsoft.com/en-us/library/...s.85).aspx

I'll check if I can at least force the timeout with non blocking socket.
10-22-2013 09:21 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #3
RE: Connection timeout
Hello,

The issue is on android only.

I am already calling clientConnectToServer from a thread. The thread keeps locked and I can't stop it after x seconds.

m_thread.del() or m_thread.kill() waits until clientConnectToServer returns false;
(This post was last modified: 10-22-2013 10:26 PM by cmontiel.)
10-22-2013 10:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Connection timeout
I was able to implement the custom timeout, will be available in next release.
10-22-2013 10:33 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #5
RE: Connection timeout
That was really fast, thanks!
10-23-2013 12:12 AM
Find all posts by this user Quote this message in a reply
Post Reply