Setting timeout to recv function

前端 未结 3 1632
生来不讨喜
生来不讨喜 2020-12-28 19:53

I read from socket using recv function. I have problem when no data available for reading. My programm just stops. I found that I can set timeout using se

3条回答
  •  清歌不尽
    2020-12-28 20:25

    use the FD_ISSET() macro to test whether there is data to read. If it returns false, don't do the read.

    http://linux.die.net/man/3/fd_set

提交回复
热议问题