Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Suppose browser send you 1360 bytes of data, you say <code>asio</code> to read some data into your buffer that you say it only have 32 bytes. then first time that you call it your handler will be called with 32 bytes start of data. here if you comment (1) then browser try to send rest of its data(actually browser already sent it and it is in the OS buffer that wait for you to peek it from there) and you are possibly blocked behind <code>io_service::run</code> for some miracle!!</p> <p>if you uncomment (1) as you say your loop started, you read first block, then next and another and ... until the data that the browser sent finished, but after that when you say <code>asio</code> to read some more data it will wait for some more data that never come from the browser( since browser already sent its information and is waiting for your answer ) and when you cancel the request from the browser, it will close its socket and then your handler will be called whith an error that say I can't read more data, since the connection is closed.!!</p> <p>but what you should do here to make it work is: you should learn <code>HTTP</code> format and thus know what is the data that your browser sent to you and provide a good answer for it and then your communication with the client will be proceeded. in this case end of buffer is <code>\r\n\r\n</code> and when you see it you shouldn't read any more data, you should process what you read till now and then send a response to the browser.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload