Hello!
Is there any way to make a program sleep until it has data from with a recv()?
Many thanks
Hello!
Is there any way to make a program sleep until it has data from with a recv()?
Many thanks
Without effort, recv() is blocking.
So yes, your program is asleep in a recv() without data.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
If you are trying to "unblock" accept() and recv()...you could just use
Code:u_long* arg = 1; ioctlsocket(thesocket, FIONBIO, &arg);
Not sure if that's what you meant.
does blocking mean , so you block data from recv , send?
Blocking means that a system call "blocks" until some condition is satisfied. In the case of recv(), it means "wait until some data is available", and in send() it would mean "wait until the data has been sent".
A non-blocking call is one that returns immediately, and you have to check some other way if some data was received or sent, or whatever it may be.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.