• It's exactly like the situation with connect. If it makes more sense, think of the description as:

    Start to send len bytes from buf on socket number sckt. Return the number of bytes that have been accepted, 0 if busy, or -1 if there was an error

    This is pretty much what happens on an OS anyway, it's not like the computer sends that packet over the network and then returns - it goes into a buffer (and it doesn't expect that the buffer you passed to send hangs around).

    And yes, the data is lost afterwards as the array is stored on the stack - if the ESP8266's send function needs the data to stay around, you'll have to allocate your own buffer for it.

    It's worth looking at socketserver.c though - it should be pretty obvious how net-> functions get used in there.

About

Avatar for Gordon @Gordon started