Reading from sockets C HTTP

前端 未结 3 1785
慢半拍i
慢半拍i 2021-01-25 08:19

I\'m wondering how I can tell if all the data has been received from a socket. It\'s a simple web proxy and right now I\'m handling the request part, so what\'s sent should term

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 08:30

    I think the plan you have is almost right. You need to keep loading the read data into a buffer until you find the desired pattern '\r\n\r\n', then you know you have the entire request and can pass it off to your processing logic, remove the request from the buffer and repeat.

提交回复
热议问题