Calling experienced network programmers

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
Posts: 4788
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: Calling experienced network programmers

Post by pythoncoder » Thu Oct 27, 2016 5:57 am

@Lysenko As I made clear in my OP I have little knowledge of networking. It is an ESP8266. The MQTT library uses blocking sockets with no timeout set. On rare occasions, presumably caused by WiFi communications issues, the blocking socket appears to block indefinitely. This strikes me as unsurprising: presumably some kind of handshake occurs at the packet level which might fail to complete. In extremis the ESP8266 could move out of range of the AP. But it's on issues like this that I was hoping to achieve enlightenment from the gurus ;)
Peter Hinch

Posts: 108
Joined: Thu May 05, 2016 8:29 pm

Re: Calling experienced network programmers

Post by jms » Thu Oct 27, 2016 3:19 pm

TCP says absolutely nothing about timing out unless you have keepalives going.

On a sensible network what is supposed to happen when one end thinks a TCP connection is closed is to reply to any attempt to talk to a socket with an RST. However this isn't reliable for example if the host simply isn't there anymore or there's a stateful firewall in the way that suppresses anything not associated with a connection it knows about.

So it is up to the socket layer implementation to provide useful mechanisms such as timeouts, non-blocking ness or poll or select and libraries built on top to use them. Failing that it's up to the application.

Post Reply