I tried using the SO_SNDTIMEO. Here is what I am seeing.
1. i create a socket using lwip_socket(AF_INET, SOCK_STREAM, 0) and then connect using lwip_connect()
2. set the SO_SNDTIME0 to 1s using lwip_setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, &timeout_int, sizeof(timeout_int))
3. then start sending data as follows
while(err > 0) {
err = lwip_write(socket, buffer, size);
}
I see that I hit the timeout condition in the 2nd to last transfer
lwip_send(0, data="" size=86264, flags=0x0) <--- this is the packet that times out
...
so_sndtimeo <-- added these printouts to check the condition I am hitting
partial write
lwip_send(0) err=0 written=67348
lwip_send(0, data="" size=86264, flags=0x0) <--- the last packet that causes the assert
panic: already writing or closing <--- we hit this in do_write() ( api_msg.c:1360)
Some questions;
1. Does that mean I cannot call lwip_write() after timing out on a previous call to lwip_write()?
2. Can I use the fact that the size returned by lwip_write() < total buffer size as an indication that our transfer timed out?
Thanks,
Alhad