本文整理汇总了Python中SocketServer.StreamRequestHandler类的典型用法代码示例。如果您正苦于以下问题:Python StreamRequestHandler类的具体用法?Python StreamRequestHandler怎么用?Python StreamRequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StreamRequestHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish
def finish(self):
""" do some cleanup here... ie remove all the
devices connected to that machine """
# remove the device
getDevMgr().removeDevice(self.deviceId)
StreamRequestHandler.finish(self)
示例2: __init__
def __init__(self, *args, **kwargs):
self.commands = dict((cmd, getattr(self, "_%s" % cmd.lower())) for cmd in COMMANDS)
self.client = None
self.player = None
self.game = None
self.servicing = True
StreamRequestHandler.__init__(self, *args, **kwargs)
示例3: setup
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
示例4: __init__
def __init__(self, *args, **kwargs):
self.proxy_object = kwargs.pop('proxy_object', self)
# LOL, standard library stuff is old style class
#
# super(CborRpcHandler, self).__init__(*args, **kwargs)
#
# So, call the super constructor the old way ...
# Work gets done in the constructor! WTF!
StreamRequestHandler.__init__(self, *args, **kwargs)
示例5: setup
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)
示例6: __init__
def __init__(self, id_, *args, **kwargs):
self._id = id_
self._peer = config["peer"]
# self._tgt_ip = config["target_ip"]
# self._tgt_port = config["target_port"]
self._tcp_sock = None
self._icmp_sock = None
self._thread = None
StreamRequestHandler.__init__(self, *args, **kwargs)
示例7: setup
def setup(self):
StreamRequestHandler.setup(self)
self._controller = FlightController.getInstance()
self._controller.start()
#self._throttle = 0.0
self._started = False
示例8: __init__
def __init__(self,*args,**kwargs):
if isinstance(SensorRecvTCPServerHandler.mongo_connection, SensorMongoORM) is not True:
initializationConfigParser = InitializationConfigParser("ServerConfig.ini")
databaseConnectConfig = initializationConfigParser.GetAllNodeItems("DataBase")
databaseConnectConfig["port"] = int(databaseConnectConfig.get("port"))
SensorRecvTCPServerHandler.mongo_connection = SensorMongoORM(**databaseConnectConfig)
logging.info(SensorRecvTCPServerHandler.mongo_connection)
self.terminal_owner = None
self.terminal_address = None
StreamRequestHandler.__init__(self,*args,**kwargs)
示例9: setup
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)
示例10: setup
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
示例11: __init__
def __init__(self, request, client_address, server):
self.connection_time = datetime.today()
self.last_connection_check = datetime.today()
self.in_data = None
self.out_data = None
self.control = server.control
self.read_errors = 0
self.write_errors = 0
self.request_errors = 0
self.client_full_address = "%s:%s" % (client_address[0],
client_address[1])
StreamRequestHandler.__init__(self, request, client_address, server)
示例12: finish
def finish(self):
StreamRequestHandler.finish(self)
# Remove this handler from the conversations dict
print('close %s:%d' % self.client_address)
if self._conversation_id is not None:
with conversations_lock:
handlers = conversations[self._conversation_id]
handlers.remove(self)
if not handlers:
del conversations[self._conversation_id]
print_conversation(self._conversation_id, handlers)
self._conversation_id = None
示例13: setup
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
示例14: __init__
def __init__(self, request, client_address, server):
self._read_buffer = ""
StreamRequestHandler.__init__(self, request, client_address, server)
示例15: __init__
def __init__(self, *args, **kwargs):
StreamRequestHandler.__init__(self, *args, **kwargs)