Skip to content
Discussion options

You must be logged in to vote

I'm no expert on this, however this is my take on it. The response from the poller merely tells you that data is available. It doesn't tell you how much to expect. The website response is a fixed length data stream of unknown length. Responding to the poller by reading N bytes will work until you get to the end of the stream. Unless the end of the stream contains exactly N bytes, the read will wait forever (as will read() with no arg). These will only terminate if the server closes the socket, which will never happen.

In other words, if the length of the server response stream is L and your socket reads are of N bytes, the loop will only terminate if L % N is zero. Which is why it works w…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RetiredWizard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants