1

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

4

1 回答 1

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

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

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)
于 2014-08-15T20:30:53.763 回答