You can chat about native SDK questions and issues here.

User avatar
By sharkx
#72548 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.
User avatar
By msateri
#72581 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.
User avatar
By sharkx
#72595 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.