Here is what the code roughly looks like:
int main() {
// All the details needed before using the send() function here...
send(socket, buffer, 1024*1024*1024, 0);
return 1;
}
If send()
is supposed to be blocking regardless of the size of the buffer then I think it shouldn't return until the entire buffer has been sent. But from what I have observed, given a large enough buffer, it does return before send()
has sent the entire buffer.
However, if I add this code before the return
statement:
while(1){}
send()
blocks as expected and sent the entire data.
Isn't send()
supposed to be blocking like that or is there something wrong with the send()
function itself?
Thanks in advance.