Hello!
Is there any way to make a program sleep until it has data from with a recv()?
Many thanks
Printable View
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 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