Calling network/socket programmers

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
pythoncoder
Posts: 3121
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Calling network/socket programmers

Post by pythoncoder » Mon Dec 03, 2018 6:46 am

I'd greatly appreciate it if you guys could read this doc at least to the end of section 1.

My background is in electronics hardware/firmware and my knowledge of internet protocols is sketchy. My observations about detecting loss of network connectivity are based more on empirical observation than on theoretical understanding. Am I missing something obvious? Is there an easier way than relying on timeouts?
Peter Hinch

stijn
Posts: 278
Joined: Thu Apr 24, 2014 9:13 am

Re: Calling network/socket programmers

Post by stijn » Mon Dec 03, 2018 9:59 am

I also only have empricial experience with socket programming on a multitude of devices and just like you have used timeouts on 'ping' calls and write buffers filling up for detecting outages. There are other ways: depending on hardware platform you can query WiFi outage directly on the WiFi and/or network driver for instance. Likewise for amount of free space in the write buffer etc. But while usually reliable, it's too hardware-dependent for generic code though, and it's not done on socket-level.

User avatar
pythoncoder
Posts: 3121
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Calling network/socket programmers

Post by pythoncoder » Mon Dec 03, 2018 6:31 pm

Alas, as I explain in the doc, querying the WiFi status of the interface is insufficient as it's a property of the interface rather than of the link. WiFi conditions at the "far end" of the link may be completely different. Long running tests in my house showed that brief outages can be very localised. The other case that it can't catch is a code failure at the far end e.g. an AP outage.

Is there a way to query the write buffer status of an ESP8266 nonblocking socket?
Peter Hinch

Post Reply