admin管理员组

文章数量:1296421

I was making a http server in c and this came to mind. Im not sure if it's possible to recieve unlimited bytes.

The server just gets the path and sends the requiered file, so in this case i dont think it needs a very big buffer, so i used a c string with the size of 2048 bytes of data for the buffer, but im still in doubth.

I was making a http server in c and this came to mind. Im not sure if it's possible to recieve unlimited bytes.

The server just gets the path and sends the requiered file, so in this case i dont think it needs a very big buffer, so i used a c string with the size of 2048 bytes of data for the buffer, but im still in doubth.

Share asked Feb 11 at 23:34 danilogames220danilogames220 256 bronze badges 1
  • If you're only receiving GET requests you don't need a bigger buffer. – user207421 Commented Feb 12 at 3:03
Add a comment  | 

1 Answer 1

Reset to default 0

Every server has a maximum length for request lines. I guess per default it is 8 kB and can be configured. For stability and security reasons this is not open. See https://httpd.apache./docs/2.4/mod/core.html#limitrequestfieldsize This buffer is used to read and parse the request.

Just in case your question was more related tot the response: The response buffer just needs to decouple response computing time from response sending time. It is a tradeoff between speed and memory footprint, and you might want to tune it related to your bandwith, available memory and number of parallel requests and the response sizes.

本文标签: webserverwhat is the ideal buffer size to recieve data for a http serverStack Overflow