반응형
struct timeval timeout; //setting timeout to socket
timeout.tv_sec=MY_TIMEOUT_VAL;
timeout.tv_usec=0;
result= setsockopt(*sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); //timeout 지정
rcv_len= recv(*sock, recv_buf, MY_RECV_LEN, MSG_WAITALL);
반응형