network_set_timeout(socket, read_timeout, write_timeout);
参数 | 描述 |
---|---|
socket | 所使用的套接字id。 |
read_timeout | 从服务端获取传输的超时毫秒数。 |
write_timeout | 向服务端发送传输的超时毫秒数。 |
返回: N/A(无返回值)
With this function you can set the timeout for reading and
writing data to/from a server through the given socket. Note that
the timeout does not generate any type of event, so you will need
to deal with timeouts yourself using alarms (for example). Note
that this value only affects the sending and receiving of data, and
should you wish to change the connection timeout value then you
should be using the function network_set_config.
network_set_timeout(sock, 3000, 3000);
The above code will set the timeout for reading and writing data through the socket indexed in the variable "sock" to 3 seconds.