-->
Page 1 of 1

espconn_connect timeout ?

PostPosted: Mon Dec 18, 2017 3:14 am
by sharkx
Hello all,

Is there a way to control the TCP connect timeout ? Can't seem to find it anywhere in the SDK pdf.
I'm stuck with the 1.3.0, but the 2.1.2 doesn't have it either.

Normally, I would put the socket in non-blocking mode, but I don't know how to do this either, eith the 1.3.0 SDK.

Thanks for any advice / tip.

Re: espconn_connect timeout ?

PostPosted: Tue Dec 19, 2017 7:28 am
by msateri
Hi,

I don't see anything in the documentation either. I don't have the definitive answer to this, but how about this:

- register a connection callback before calling espconn_connect() (I assume you already do this)
- also set up a timer callback for whatever time you want as your connection timeout. Pass the espconn struct pointer as argument to the timer callback
- in the connect callback, disarm the timer
- if you get to the timer callback, you know that the connection has timed out. Call espconn_disconnect() or espconn_abort() to abort the connection.

Don't know if it works to call abort() on a connection that hasn't been established, but since nobody else has suggested anything better perhaps it is worth trying :-). Good luck.

Re: espconn_connect timeout ?

PostPosted: Wed Dec 20, 2017 3:43 am
by sharkx
Thanks for the reply.

Unfortunately, there's one big problem... the espconn_abort is not available in the 1.3.0 SDK, and I'm kind of stuck with this one.

I'm still using some 512k modules, and I'm already using almost all available space (I need the OTA update, so my code is actually limited to 236k).

I'mm try to see if by any chance espconn_abort is available, but not declared in the headers.

Re: espconn_connect timeout ?

PostPosted: Thu Dec 21, 2017 3:51 pm
by sharkx
Well... no; can't make espconn_abort work in the 1.3.0 SDK.