Looking at examples online, all of them seem to have:
int read = s.EndReceive(ar);
if (read > 0) {//Some code}
The question I have is...why?
Why bother with the if (read > 0)
when the MSDN says that EndReceive blocks until data is received?
If you call int read = s.EndReceive(ar);
your code execution halts until the socket receives something. Once it does, it stops blocking and then will evaluate the if statement...wouldn't the if statement always return true or is it possible to receive 0 bytes?