gsoap初始化释放_gsoap 超时(timeout)设置

gsoap就不用介绍了,是一个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).

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)

vue-resource请求超时timeout设置

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

Httpclient超时timeout设置

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

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

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

axios超时timeout拦截

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

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

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

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

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

Socket超时时间设置

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

session超时时间设置方法

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

unigui session超时时间设置

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

GS 服务器超时时间设置

工作中 遇到一个超时的问题 与徐庆同学沟通后 了解了下超时时间设置的地方 1.web.congfig问题: 常规路径 C:\Program Files\GenerSoft\bscw_local\web ...

随机推荐

WPF数据双向绑定

设置双向绑定,首先控件要绑定的对象要先继承一个接口: INotifyPropertyChanged 然后对应被绑定的属性增加代码如下: 意思就是当Age这个属性变化时,要通知监听它变化的人. 即:Pr ...

YCbCr

http://blog.csdn.net/shizhixin/article/details/4494358 YCbCr 则是在世界数字组织视频标准研制过程中作为ITU - R BT1601 建议的一 ...

WPF MediaElement播放器2

在此问个问题,MediaElement播放本地和http上的视频没问题,但是ftp的怎么在本例中播放不了 若高手了解,请不吝赐教 using System; using System.Collecti ...

Python并发编程之学习异步IO框架:asyncio 中篇(十)

大家好,并发编程 进入第十章.好了,今天的内容其实还挺多的,我准备了三天,到今天才整理完毕.希望大家看完,有所收获的,能给小明一个赞.这就是对小明最大的鼓励了.为了更好地衔接这一节,我们先来回顾一下上 ...

Django 分页器的使用

Django 分页器的使用 Django作为Python Web开发框架的一哥,提供了企业级网站开发所需要的几乎所有功能,其中就包括自带分页功能.利用Django自带的Paginator类,我们可以很 ...

ios-微信支付登录分享-notification通知

// //  AppDelegate.m //  NewAppBase // //  Created by ENERGY on 2018/5/17. //  Copyright © 2018年 ENE ...

vue-7-表单

示例:

Message is: { ...

动态规划 51nod 1183

题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1183 1183 编辑距离  基准时间限制:1 秒 空间限制:1 ...

ZOJ2018/4月月赛G题Traffic Light(广搜)

题意:首先T组数据,每组数据包括:第一行:一个n,m,然后下面有一个n行m列的01矩阵. 最后一行输入四个数字,分别是起点的横纵坐标,终点的横纵坐标.询问从起点到终点,最少要几步,如果到不了输出-1 ...

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值