本文整理汇总了Python中SocketServer.StreamRequestHandler.setup方法的典型用法代码示例。如果您正苦于以下问题:Python StreamRequestHandler.setup方法的具体用法?Python StreamRequestHandler.setup怎么用?Python StreamRequestHandler.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketServer.StreamRequestHandler
的用法示例。
在下文中一共展示了StreamRequestHandler.setup方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
self.sb = "\x0b"
self.eb = "\x1c"
self.cr = "\x0d"
self.validator = re.compile(self.sb + "(([^\r]+\r)*([^\r]+\r?))" + self.eb + self.cr)
self.handlers = self.server.handlers
self.timeout = self.server.timeout
StreamRequestHandler.setup(self)
示例2: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
global hb_timeout
StreamRequestHandler.setup(self)
self.request.settimeout(hb_timeout)
self._request_process = {
HEARTBEAT_REQUEST:self._heartbeat_process,
REPLACE_REQUEST:self._replace_process
}
self.timestamp = None
示例3: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)
self._controller = FlightController.getInstance()
self._controller.start()
#self._throttle = 0.0
self._started = False
示例4: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
self.sb = b"\x0b"
self.eb = b"\x1c"
self.cr = b"\x0d"
self.validator = re.compile(
''.join([self.sb.decode('ascii'), r"(([^\r]+\r)*([^\r]+\r?))", self.eb.decode('ascii'), self.cr.decode('ascii')]))
self.handlers = self.server.handlers
self.timeout = self.server.timeout
StreamRequestHandler.setup(self)
示例5: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)
self._controller = FlightController.getInstance()
self._controller.setPidThrottleThreshold(Dispatcher.PID_THROTTLE_THRESHOLD)
self._controller.start()
self._throttleByUser = False
self._throttle = 0.0
self._started = False
示例6: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)
self._tcp_sock = self.request
icmp = socket.getprotobyname("icmp")
self._icmp_sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)
# send_data = ICMPPacket.create(ICMP_ECHO, 0, self._id, 0, "")
# self._icmp_sock.sendto(send_data, (self._peer, 0))
seq = 0
send_data = ICMPPacket.create(ICMP_ECHO, 0, self._id, seq, "xnew")
logger.debug("[%d]# new connection", self._id)
while self._tcp_sock:
self._icmp_sock.sendto(send_data, (self._peer, 0))
rfds, _, _ = select.select([self._icmp_sock], [], [], 0.1)
if not rfds:
continue
data, addr = self._icmp_sock.recvfrom(MAX_BUF_LEN)
_, id_, r_seq, payload = ICMPPacket.parse(data)
# print addr[0], self._peer, id_, self._id, r_seq, seq
if addr[0] == self._peer and id_ == self._id and \
r_seq == seq and payload == "xnew":
logger.debug("[%d]# conn success", self._id)
break
示例7: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)
self.keep_alive = True
self.handshake_done = False
self.valid_client = False
示例8: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
self.server.handlers.add(self)
StreamRequestHandler.setup(self)
示例9: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)
self.objectStream = wrapSocketForPickle(self.connection)
self.intoMeetingPlace()
示例10: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
print('connect %s:%d' % self.client_address)
StreamRequestHandler.setup(self)
示例11: setup
# 需要导入模块: from SocketServer import StreamRequestHandler [as 别名]
# 或者: from SocketServer.StreamRequestHandler import setup [as 别名]
def setup(self):
StreamRequestHandler.setup(self)