Page 1 of 1

HTTP Server does not send response until netconn is close/delete

Posted: Wed Mar 21, 2018 7:31 am
by rahul.b.patel
Hello,
I am facing some issues with IDFv2.1 with HTTP Restful server. Following snippet describe my issue,
  • create netconn
    bind and listen on socket
    accept the connection when available
    receive data with netconn_recv and netbuf_data
    response to client with netconn_write
    close and delete netconn.
This works fine and got response into client(postman utility) perfectly. But when I remove netconn_close/delete there is no response to client.
Following is not giving response to client,
  • create netconn
    bind and listen on socket
    accept the connection when available
    receive data with netconn_recv and netbuf_data
    response to client with netconn_write
can anybody give me idea why server does not response successfully while not closing netconn socket.???

Thanks

Re: HTTP Server does not send response until netconn is close/delete

Posted: Wed Mar 21, 2018 8:08 am
by WiFive
https://www.w3.org/Protocols/HTTP/1.0/d ... BodyLength
Otherwise, the body length is determined by the closing of the connection by the server.

Re: HTTP Server does not send response until netconn is close/delete

Posted: Wed Mar 21, 2018 9:56 am
by rahul.b.patel
Hi WiFive,
Thanks for early reply. Your suggestion is right on. Its working with adding content length field into HTTP response header.