參考:http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc19.19html
gsoap就不用介紹了,是一個c/c++編寫的可用於服務端與客戶端的鏈接工具。c++
Socket connect, accept, send, and receive timeout values can be set to manage socket communication timeouts. The soap.connect_timeout, soap.accept_timeout, soap.send_timeout, and soap.recv_timeout attributes of the current gSOAP runtime context soap can be set to the appropriate user-defined socket send, receive, and accept timeout values. A positive value measures the timeout in seconds. A negative timeout value measures the timeout in microseconds (10−6 sec).
This will result in a timeout if no data can be send in 10 seconds and no data is received within 10 seconds after initiating a send or receive operation over the socket. A value of zero disables timeout, for example:
When a timeout occurs in send/receive operations, a SOAP_EOF exception will be raised ("end of file or no input"). Negative timeout values measure timeouts in microseconds, for example:
The macros improve readability. |
初始化gsoap後,而後就能夠設置了。app
在struct soap裏面 是有不少參數的,具體能夠參見 stdsoap2.h文件。。socket
只要工具
soap.send_timeout = 10;
soap.recv_timeout = 10;spa
就能夠。。htm
由於gsoap使用的包裝http協議。而後最主要的是socket傳輸,對於咱們熟悉的socket傳輸,咱們在非阻塞的狀況下才能設置超時。(包括 鏈接超時 accetp_timeout, 發送超時 send_timeout, 以及接受超時 recv_timeout)ci
。pdo