I'm using lwip to write an http server. Initially I was using the netconn
API, but I'm trying to switch to the sockets API since I find it a bit less
awkward.

After this change, web clients now receive "connection reset" errors upon
visiting a page. I've gotten it to work if the entire response is written in
one lwip_send() call, but if for instance the header is written in a
different call than the message body then the "connection reset" error
occurs (I've checked this with a few browsers). I've checked using telnet to
verify that identical data (at the payload level) is being received in
either case. In other words

>   sprintf(outbuf, "<response header><response body>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   lwip_close(sock);

works as expected but

>   sprintf(outbuf, "<response header>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   sprintf(outbuf, "<response body>");
>   lwip_send(sock, outbuf, strlen(outbuf), 0);
>   lwip_close(sock);

does not. It still triggers the error if the MSG_MORE flag is passed to the
first lwip_send(), which I thought might help. Neither does a "Connection:
close" field in the response header make any difference.


What could be the issue here?
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to