设置非阻塞的recvfrom


 int iMode= 1; //1,非阻塞;0,阻塞
  ioctlsocket(socketc,FIONBIO,(u_long FAR*) &iMode);//非阻塞设置

  n=recvfrom(socket,rbuf,sizeof(szbuf),0,(SOCKADDR*)&addr,&len);

int ioctlsocket (
  SOCKET
s,        
  long
cmd,        
  u_long FAR*
argp 
);

s
[in] A descriptor identifying a socket.
cmd
[in] The command to perform on the socket s.
argp
[in/out] A pointer to a parameter for cmd.

你可能感兴趣的:(socket,command,Descriptor,Sockets)