参考: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. Group Commit of Binary Log

    160222 09:19:26 mysqld_safe Starting mysqld daemon with databases from /data01/mysql 2016-02-22 09:1 ...

  2. 2016 Multi-University Training Contest 5&6 总结

    第五场和第六场多校都打得很糟糕. 能做到不以物喜不以己悲是假的,这对队伍的情绪也可以算上是比较大的打击. 很多时候我们发现了问题,但是依旧没有采取有效的方法去解决它,甚至也没有尝试去改变.这是一件相当 ...

  3. poj2013---二维数组指针使用

    #include <stdio.h> #include <stdlib.h> #include<string.h> int main() { ; ][],arr2[ ...

  4. linux下查看文件内容cat,more,less

    1. 查看文件内容经常使用的命令 cat : 由第一行显示文件内容 tac:  从最后一行開始显示.与cat相反 nl :  文件内容和行号一起输出 more: 一页一页显示 less: 与more类 ...

  5. C#深复制和浅复制

    本文在于巩固基础 我们来看看什么是深复制.浅复制: C#中对于数据的复制机制虽然简单但是容易让人误解.C#数据类型大体分为值类型(value type)与引用类型(reference type).对于 ...

  6. MySQL学习笔记(4)

    插入记录① INSERT [INTO] tbl_name [(col_name,-)] {VALUES | VALUE} ({expr | DEFAULT},-),(-),- 可以用表达式或者DEFA ...

  7. activemq的两种基本通信方式的使用及总结

    简介 在前面一篇文章里讨论过几种应用系统集成的方式,发现实际上面向消息队列的集成方案算是一个总体比较合理的选择.这里,我们先针对具体的一个消息队列Activemq的基本通信方式进行探讨.activem ...

  8. spring aop简单日志实例

    转载自:http://www.blogjava.net/laoding/articles/242611.html 一直就用spring的IOC,遗憾spring的另一重要组成部分AOP却没用过,所以近 ...

  9. 修改UISearchBar背景颜色

    UISearchBar是由两个subView组成的,一个是UISearchBarBackGround,另一个是UITextField. 要IB中没有直接操作背景的属性.方法一:是直接将 UISearc ...

  10. 在工作空间中构建和使用catkin包

    在这篇博客中将会介绍,如何在工作空间中构建和使用一个包. 首先,我们来看一下如何在catkin工作空间中,使用catkin_make工具从源文件构建和安装一个包.使用catkin_make来构建一个c ...