本文整理汇总了Python中SocketServer.UDPServer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python UDPServer.__init__方法的具体用法?Python UDPServer.__init__怎么用?Python UDPServer.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketServer.UDPServer
的用法示例。
在下文中一共展示了UDPServer.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, HOST='localhost', PORT=4000, handler=KodemonUDPHandler, db_conn_string='sqlite:///AppData/Kodemon.sqlite'):
#Set up the server
UDPServer.__init__(self, (HOST, PORT), handler)
#Set up the database connection
engine = create_engine(db_conn_string)
self.Session = sessionmaker(bind=engine)
示例2: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, server_address, RequestHandlerClass):
UDPServer.__init__(self, server_address, RequestHandlerClass)
self._shutdown_request = False
# watchdog guards against the failure mode when the remote target fails
# to send any packets. If the watchdog reaches the high water mark, the
# server is terminated so as not to leave the server thread unterminated
self.watchdog = 0.0
示例3: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__ (self):
from app import APP
port = APP.BE.LOGGING._i_server_port
UDPServer.__init__(self, ('127.0.0.1', port), None)
Process.__init__ (self, None, None, "pcLOG" )
self.queue = Queue( APP.BE.LOGGING._i_queue_size )
self.backend = LoggingBackend (self.queue)
self.backend.start()
self.on = True
self.start()
示例4: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, regnancy_server_address):
for port in xrange(12000, 25000):
try:
logging.info("UDPServer starts")
UDPServer.__init__(self, ("", port), Handler)
logging.info("UDPServer runs %i", port)
break
except:
pass
self.timeout = 0.05
RegnancyUDPServer.regnancy_server_address = \
regnancy_server_address
self.running = True
示例5: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, args):
"""Instantiate an OSCServer.
server_address ((host, port) tuple): the local host & UDP-port
the server listens on
"""
self.address_family = args.address_family
self.args = args
self.own_address = client_host, client_port = resolve_host(args.client_host, args.client_port, self.address_family, socket.AI_PASSIVE)
self.chaosc_address = chaosc_host, chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, self.address_family)
logger.info("binding to %s:%r", client_host, client_port)
UDPServer.__init__(self, self.own_address, OSCRequestHandler)
self.socket.setblocking(0)
if hasattr(args, "subscribe") and args.subscribe:
self.subscribe_me()
self.callbacks = {}
示例6: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, address=("239.255.255.250", 1900), handler_class=SSDPHandler):
self._notifications = list()
self._scheduled_timers = list()
UDPServer.__init__(self, address, handler_class, bind_and_activate = False)
# needed to receive multicast messages
mreq = struct.pack("=4sl", socket.inet_aton("239.255.255.250"), socket.INADDR_ANY)
self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, 1)
self.notification_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.server_bind()
self.server_activate()
示例7: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, server_address, RequestHandlerClass, container,
thread_class = Thread):
UDPServer.__init__(self, server_address, RequestHandlerClass)
CustomThreadingMixIn.__init__(self, thread_class)
self.container = container
self.daemon_threads = True
示例8: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, local_address = ('127.0.0.1', 69) ):
UDPServer.__init__(self, local_address, None)
示例9: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, server_address, RequestHandlerClass, config):
self.config = config
UDPServer.__init__(self, server_address, RequestHandlerClass)
示例10: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, cdn_name, server_address, handler_class=DNSUDPHandler):
self.name = cdn_name
UDPServer.__init__(self, server_address, handler_class)
return
示例11: __init__
# 需要导入模块: from SocketServer import UDPServer [as 别名]
# 或者: from SocketServer.UDPServer import __init__ [as 别名]
def __init__(self, **kwargs):
host = kwargs.get('host', '127.0.0.1')
port = int(kwargs.get('port', 8881))
UDPServer.__init__(self, (host, port), WowzaHandler)
self.db = DbLogger(**kwargs)