Page 1 of 1

recvfrom

Posted: Tue May 11, 2010 7:07 am
by dheart88
Is recvfrom stop all task until it received UDP message? and how to solve this?

Re: recvfrom

Posted: Tue May 11, 2010 8:31 am
by dheart88
problem solved:
there's ioctl function... I didn't know about the function until I read socket.h and compare the function from other resources... use

Code: Select all

#include <sys/types.h>
#include <sys/socket.h>
// no need to use this, because it's included in socket.h #include <sys/ioctl.h>
⋮
int dontblock;
int rc;
int server_sock
⋮
/* Place the socket into nonblocking mode */
dontblock = 1;
rc = ioctl(server_sock, FIONBIO, (char *) &dontblock);