本文整理汇总了Python中socket.SO_OOBINLINE属性的典型用法代码示例。如果您正苦于以下问题:Python socket.SO_OOBINLINE属性的具体用法?Python socket.SO_OOBINLINE怎么用?Python socket.SO_OOBINLINE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类socket
的用法示例。
在下文中一共展示了socket.SO_OOBINLINE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_expt
# 需要导入模块: import socket [as 别名]
# 或者: from socket import SO_OOBINLINE [as 别名]
def handle_expt(self):
"""Called when there is out of band (OOB) data to be read.
This might happen in case of such clients strictly following
the RFC-959 directives of sending Telnet IP and Synch as OOB
data before issuing ABOR, STAT and QUIT commands.
It should never be called since the SO_OOBINLINE option is
enabled except on some systems like FreeBSD where it doesn't
seem to have effect.
"""
if hasattr(socket, 'MSG_OOB'):
try:
data = self.socket.recv(1024, socket.MSG_OOB)
except socket.error, err:
if err.args[0] == errno.EINVAL:
return
else:
self._in_buffer.append(data)
return
示例2: testSO_KEEPALIVE
# 需要导入模块: import socket [as 别名]
# 或者: from socket import SO_OOBINLINE [as 别名]
def testSO_KEEPALIVE(self):
self.test_tcp_client = 1
self.test_tcp_server = 1
self._testOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])
self._testInheritedOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])
# def testSO_LINGER(self):
# self.test_tcp_client = 1
# self.test_tcp_server = 1
# off = struct.pack('ii', 0, 0)
# on_2_seconds = struct.pack('ii', 1, 2)
# self._testOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])
# self._testInheritedOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])
# # WILL NOT FIX
# def testSO_OOBINLINE(self):
# self.test_tcp_client = 1
# self.test_tcp_server = 1
# self._testOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1])
# self._testInheritedOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1])
示例3: __init__
# 需要导入模块: import socket [as 别名]
# 或者: from socket import SO_OOBINLINE [as 别名]
def __init__(self, conn):
asynchat.async_chat.__init__(self, conn)
# tells the socket to handle urgent data inline (ABOR command)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
self.set_terminator(b"\r\n")
self.in_buffer = []
self.dtp = None
self.last_received_cmd = None
self.last_received_data = ''
self.next_response = ''
self.next_data = None
self.rest = None
self.next_retr_data = RETR_DATA
self.push('220 welcome')
示例4: testSO_OOBINLINE
# 需要导入模块: import socket [as 别名]
# 或者: from socket import SO_OOBINLINE [as 别名]
def testSO_OOBINLINE(self):
self.test_tcp_client = 1
self._testOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1])