我在U2 Universe手册中到处搜索,但是我没有看到在调用submitRequest函数后如何关闭连接的任何示例。有谁知道?
答案 0 :(得分:1)
无需关闭连接,因为disconnect(和connect)内置于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)