当前位置: 首页>>代码示例>>Python>>正文


Python socket.RCVALL_OFF属性代码示例

本文整理汇总了Python中socket.RCVALL_OFF属性的典型用法代码示例。如果您正苦于以下问题:Python socket.RCVALL_OFF属性的具体用法?Python socket.RCVALL_OFF怎么用?Python socket.RCVALL_OFF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在socket的用法示例。


在下文中一共展示了socket.RCVALL_OFF属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wait_for_connection

# 需要导入模块: import socket [as 别名]
# 或者: from socket import RCVALL_OFF [as 别名]
def wait_for_connection(self):
        import socket
        import sys
        # Create a TCP/IP socket
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.server_address = ('localhost', self.port)
        #print('starting up on %s port %s' % self.server_address, file=sys.stderr)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        #self.sock.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
        self.sock.bind(self.server_address)
        self.sock.listen(10)
        #self.sock.setblocking(0)
        while self.closed is False:
            try:
                connection, client_address = self.sock.accept()
                if self.debug:
                    print("Accepted connection.")
                thread.start_new_thread(self.serve,(connection, client_address))
            except Exception as e:
                print(e)
                raise
        self.sock.close()
        self.closed = True 
开发者ID:jahuth,项目名称:convis,代码行数:25,代码来源:png.py

示例2: close

# 需要导入模块: import socket [as 别名]
# 或者: from socket import RCVALL_OFF [as 别名]
def close(self):
        if not self.closed and self.promisc:
            self.ins.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
        super(L3WinSocket, self).close() 
开发者ID:secdev,项目名称:scapy,代码行数:6,代码来源:native.py

示例3: listen_raw

# 需要导入模块: import socket [as 别名]
# 或者: from socket import RCVALL_OFF [as 别名]
def listen_raw():
    # http://stackoverflow.com/questions/1117958/how-do-i-use-raw-socket-in-python
    HOST = socket.gethostbyname(socket.gethostname())
    s = socket.socket(socket.AF_INET, socket.SOCK_RAW)
    # s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    # s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
    s.bind((HOST, PORT))
    # s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
    while True:
        x = s.recvfrom(2048)
        print(x)
    s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)


# def main(args):
#     cmd = '{} -m src.udp.udp_listener -f start_udp_listener -b {}'.format(args.python_cmd, args.buffer_size)
#     out_queue, in_queue = mu.run_command_in_new_thread(
#         cmd, read_stderr=False, read_stdin=False, stdout_func=reading_from_rendering_stdout_func)
#
#
#     while True:
#         stdout_print('listening to stdin!')
#         line = sys.stdin.read()
#         if line != '':
#             stdout_print('UDP listener: received "{}"'.format(line))
#             if line == 'stop':
#                 stdout_print('Stop listening')
#                 udp_listening = False
#
#     # except:
#     #     print(traceback.format_exc())
#
# 
开发者ID:pelednoam,项目名称:mmvt,代码行数:36,代码来源:udp_listener.py


注:本文中的socket.RCVALL_OFF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。