【问题标题】:How to close a submitRequest function in U2/Universe如何在 U2/Universe 中关闭 submitRequest 函数
【发布时间】:2014-08-01 20:20:01
【问题描述】:

我在 U2 Universe 手册中到处搜索,但没有看到任何关于如何在调用 submitRequest 函数后关闭连接的示例。有谁知道吗?

【问题讨论】:

  • 请发布一段代码,显示您调用 submitRequest 的位置
  • 下面是代码是代码,如果errCode为0,则调用程序中的下一条语句。第 232 行:errCode = setHTTPDefault("version", "1.1") 第 250 行:errCode = creteSecurityContext(securityContext, version) 第 268 行:errCode = addAuthenticationRule(securityContext, "2", "VerificationStrength", "generous") 第 288 行: errCode = createSecureRequest(mandrillPostUrl, httpMethod, requestHandle, securityContext) 第 306 行:errCode = submitRequest(requestHandle, httpTimeOut, mandrillDcdRec, responseHeaders, responseData, httpStatus)

标签: universe u2 unidata


【解决方案1】:

没有必要关闭连接,因为断开连接(和连接)内置在 submitRequest 中。

如果你打开协议日志,你可以看到,在读取整个响应之后,Universe 关闭了连接作为 submitRequest 的一部分:

0574: 11/23/2010 16:18:41 [ 7440 6596 ] SSL read: status=NONE,len=7866
0575: 11/23/2010 16:18:41 [ 7440 6596 ] Socket 23dbe20: 7866 chars read
0576: 11/23/2010 16:18:41 [ 7440 6596 ] HTTP_MOREDATA: bytes_read=7866, total_re
ad=16058, bytes_remainig=0
0577: 11/23/2010 16:18:41 [ 7440 6596 ] HTTP_MOREDATA: data completely read
0578: 11/23/2010 16:18:41 [ 7440 6596 ] HTTP_FINISH
0579: 11/23/2010 16:18:41 [ 7440 6596 ] in destroySocket(): socket 23dbe20 refs=
1
0580: 11/23/2010 16:18:41 [ 7440 6596 ] Socket 23dbe20 closed and freed: 0(No er
ror) 0(No error)
0581: 11/23/2010 16:18:41 [ 7440 6596 ] Host 23711e0 freed

您还可以看到作为 submitRequest 的一部分打开连接的 Universe:

0067: 11/23/2010 16:18:39 [ 7440 6596 ] HTTP_START: timeout=60000
0068: 11/23/2010 16:18:39 [ 7440 6596 ] HTTP_CONNECT
0069: 11/23/2010 16:18:39 [ 7440 6596 ] new host 23711e0:www.example.org:4
43 allocated (proxy:no)
0070: 11/23/2010 16:18:39 [ 7440 6596 ] host www.example.org:443 not found
 in hostList
0071: 11/23/2010 16:18:39 [ 7440 6596 ] socket 23dbe20 allocated
0072: 11/23/2010 16:18:39 [ 7440 6596 ] start SSLbinding ...

作为一个有用的参考,下面是一个如何打开协议日志记录的示例:

LOGRECORDID = "MY_LOG_IN_THE_ROOT_OF_THE_ACCOUNT.LOG"
RESULT = protocolLogging(LOGRECORDID,"ON",10)
ERROR = submitRequest(requestHandle, httpTimeOut, mandrillDcdRec, responseHeaders, responseData, httpStatus)
RESULT = protocolLogging(LOGRECORDID,"OFF",0)

【讨论】:

  • 感谢 webthaumaturge 提供的信息。我还需要将标题更改为“application/json”,所以我使用了以下 api,但它似乎不起作用。我做对了吗? errCode=setRequestHeader(requestHandle, "Content-Type", "application/json")
  • 设置标题看起来是正确的。您可能已经知道这一点,但请确保在运行 submitRequest() 之前使用该代码。如果您仍然遇到问题,请发布您的协议记录结果。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-19
相关资源
最近更新 更多