本文整理匯總了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])