参考:http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc19.19

gsoap就不用介绍了,是一个c/c++编写的可用于服务端与客户端的连接工具。

Socket connect, accept, send, and receive timeout values can be set to manage socket communication timeouts. The soap.connect_timeoutsoap.accept_timeoutsoap.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).

 

The soap.connect_timeout specifies the timeout for soap_call_ns__method calls.

 

The soap.accept_timeout specifies the timeout for soap_accept(&soap) calls.

 

The soap.send_timeout and soap.recv_timeout specify the timeout for non-blocking socket I/O operations.

 

Example:

struct soap soap; 
soap_init(&soap); 
soap.send_timeout = 10; 
soap.recv_timeout = 10;

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:

soap.send_timeout = 0; 
soap.recv_timeout = 0;

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:

#define uSec *-1 
#define mSec *-1000 
soap.accept_timeout = 10 uSec; 
soap.send_timeout = 20 mSec; 
soap.recv_timeout = 20 mSec;

The macros improve readability.

 

Caution: many Linux versions do not support non-blocking connect(). Therefore, setting soap.connect_timeout for non-blocking soap_call_ns__method calls may not work under Linux.

 

Caution: interrupts (EINTR) can affect the blocking time in I/O operations. The maximum number of EINTR that will not trigger an error is set by SOAP_MAXEINTR in stdsoap2.h, which is 10 by default. Each EINTR may increase the blocking time by up to one second, up to SOAP_MAXEINTR seconds total.

初始化gsoap后,然后就可以设置了。

在struct soap里面 是有很多参数的,具体可以参见  stdsoap2.h文件。。

只要

soap.send_timeout = 10; 
soap.recv_timeout = 10;

就可以。。

因为gsoap使用的包装http协议。然后最主要的是socket传输,对于我们熟悉的socket传输,我们在非阻塞的情况下才能设置超时。(包括 连接超时 accetp_timeout, 发送超时 send_timeout, 以及接受超时 recv_timeout)

gsoap 超时(timeout)设置的更多相关文章

  1. vue-resource请求超时timeout设置

    请求超时设置通过拦截器Vue.http.interceptors实现具体代码如下 main.js里在全局拦截器中添加请求超时的方法 方法1:超时之后会调用请求中的onTimeoutd方法,then方法 ...

  2. Httpclient超时timeout设置

    一:连接超时:connectionTimeout 1:指的是连接一个url的连接等待时间. 二:读取数据超时:soTimeout 1:指的是连接上一个url,获取response的返回等待时间. Fo ...

  3. c# webConfig中的session超时详细设置

    webConfig中的session超时详细设置 我们在webConfig中设置Session超时的时候,如果最后发行的地址是远程服务器,我们很多不是必须的属性并不用设置,如果设之后,倒不能让 ses ...

  4. axios超时timeout拦截

    应用场景: 在网络请求中,可能不可避免的会遇到网络差或者请求超时的情况,这时候,如果你采用的技术是axios,那就可以通过设置拦截器捕获这个异常情况,并做出下一步处理. 代码实践: ① 设置拦截器,返 ...

  5. MYSQL的数据连接超时时间设置

    大规模多线程操作事务的时候,有时候打开一个链接,会进行等待,这时候如果数据库的超时时间设置的过短,就可能会出现,数据链接自动被释放,当然设置过大也不好,慢SQL或其他因素引起的链接过长,导致整个系统被 ...

  6. 【Hadoop】Hadoop DataNode节点超时时间设置

    hadoop datanode节点超时时间设置 datanode进程死亡或者网络故障造成datanode无法与namenode通信,namenode不会立即把该节点判定为死亡,要经过一段时间,这段时间 ...

  7. Socket超时时间设置

    你知道在 Java 中怎么对 Socket 设置超时时间吗?他们的区别是什么?想一想和女朋友打电话的场景就知道了,如果实在想不到,那我们就一起来来看一下是咋回事吧 设置方式 主要有以下两种方式,我们来 ...

  8. Nginx的超时timeout配置详解

    Nginx的超时timeout配置详解 本文介绍 Nginx 的 超时(timeout)配置. Nginx 处理的每个请求均有相应的超时设置.如果做好这些超时时间的限定,判定超时后资源被释放,用来处理 ...

  9. session超时时间设置方法

    session超时时间设置方法 由于session值之前没有设置,以至于刚登录的网站,不到一分钟就超时了,总结了一下,原来是session过期的原因,以下是设置session时间的3个方法: 1. 在 ...

  10. unigui session超时时间设置

    unigui session超时时间设置 默认的SESSION超时时间是10分钟. 网络 SOCKET 程序,像 数据库,中间件,UNIGUI等...为了防止过多的僵死连接卡死服务端,服务端都会主动踢 ...

随机推荐

  1. 利用指针突破C++编译器的防线

    C++ 面向对象的一大特性就是封装,使用不同的访问控制符来控制外接对其的访问权限.比如: class A { public: A(): i(){} void print(){ cout << ...

  2. hadoop源码eclipse环境搭建-源码获取阶段

    就目前了解,结合eclipse阅读和编译hadoop源码用两种方式:svn和git. 根据官方指南http://wiki.apache.org/hadoop/EclipseEnvironment 推荐 ...

  3. 面向对象程序设计-C++_课时24多态的实现

    所有带virtual的类的对象,里面最上面有一个隐藏的指针vptr,指向一张表vtable #include <iostream> using namespace std; class A ...

  4. python socket理论知识

    一.socket理论: 发现一个很好的文章,一个高手写的,我也就不再做搬运工了,直接连接吧,对理论感兴趣的可以去看看! http://www.cnblogs.com/dolphinX/p/346054 ...

  5. HDU 3641 Treasure Hunting(阶乘素因子分解+二分)

    题目链接:pid=3641">传送门 题意: 求最小的 ( x! ) = 0 mod (a1^b1*a2^b2...an^bn) 分析: 首先吧a1~an进行素因子分解,然后统计下每一 ...

  6. dom4j和jaxp解析工具的

    dom4j解析中的几个对象 node --branch --document --element --commment --attribute --text branch --document --e ...

  7. oracle 快照(snapshot) 管理

     ----手工创建oracle 快照 BEGIN DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); END; / ---删除快照 详细快照信息能够查看视图 ...

  8. telnet测试端口号

    telnet Ip 端口号 如:telnet localhost 1433 详见此链接(转) http://www.3lian.com/edu/2012/11-08/43232.html

  9. Building Workspace速度慢的原因

    今天把ext3.0部署到web project很慢很慢,查了一下,这个当笔记. 转自http://blog.163.com/jong_cai/blog/static/87028045201311178 ...

  10. 选择器,$("A+B") 和$("A~B") 的理解

    在我发表这个理解之前,我有看过博客园 永恒浪子 大神的 JQuery选择器大全(http://www.cnblogs.com/hulang/archive/2011/01/12/1933771.htm ...