Wednesday, 15 February 2012

c - I want to make accept system call as non blocking. How can i make accept system call as non blocking? -



c - I want to make accept system call as non blocking. How can i make accept system call as non blocking? -

this statement using:

m_stat_arr_nclient_sockfd[nindex]= accept(nserversocket,(struct sockaddr *)&client_address, (socklen_t *)&client_len);

this blocking call, how can create non-blocking?

you'll have utilize fcntl set nserversocket non blocking;

int flags = fcntl(nserversocket, f_getfl, 0); fcntl(nserversocket, f_setfl, flags | o_nonblock);

once you've done that, calls accept() on socket should no longer block.

c linux

No comments:

Post a Comment