I set a timeout for recvfrom() by calling select() on a UDP socket:
socket()=>sendto()=>select()=>recvfrom().
It seems that it need not call bind() or connect() for UDP socket here.
This method is recommended by
"UNIX Network Programming Volum1 Networking APIs: Sockets and XTI(Second Edition)",
W.
On Fri, Oct 31, 2003 at 01:14:17PM +0800, zhouxin wrote:
> Cygwin implementation of select() take 100% CPU under multi-thread environment
> sometimes.
> [...]
> if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){
> fprintf(stderr, "cannot open socket for udp packet!\n");
> exit(
2 matches
Mail list logo