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

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

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

Postby rahul.b.patel » Wed Mar 21, 2018 7:31 am

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

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

Postby WiFive » Wed Mar 21, 2018 8:08 am

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.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

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

Postby rahul.b.patel » Wed Mar 21, 2018 9:56 am

Hi WiFive,
Thanks for early reply. Your suggestion is right on. Its working with adding content length field into HTTP response header.

Who is online

Users browsing this forum: Bing [Bot], RandomInternetGuy and 120 guests