本文整理汇总了Python中SocketServer.ThreadingTCPServer.get_request方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadingTCPServer.get_request方法的具体用法?Python ThreadingTCPServer.get_request怎么用?Python ThreadingTCPServer.get_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketServer.ThreadingTCPServer
的用法示例。
在下文中一共展示了ThreadingTCPServer.get_request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_request
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import get_request [as 别名]
def get_request(self):
# Calls accept inside
client_sock, client_addr = ThreadingTCPServer.get_request(self)
# Hold a reference to our new client
self.clients[client_addr] = Client(client_sock)
print 'self.clients', pformat(self.clients)
return client_sock, client_addr
示例2: import
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import get_request [as 别名]
'''
Created on 2015年2月6日
@author: wangxun
'''
import SocketServer
from SocketServer import (TCPServer,StreamRequestHandler as SRH,
ThreadingTCPServer)
from time import ctime
from pip._vendor.requests.api import request
class MyRequestHandler(SRH):
def handle(self):
while True:
data = self.request.recv(1024)
print "receive from(%r):%r " % (self.client_address,data)
data1 =ctime() +':'+data
print data1
self.request.sendall(data1)
tcpSer=ThreadingTCPServer(("10.27.0.189",50007),MyRequestHandler)
while True:
print '44'
print tcpSer.get_request()[0]
print "waiting for connection"
tcpSer.serve_forever()
示例3: get_request
# 需要导入模块: from SocketServer import ThreadingTCPServer [as 别名]
# 或者: from SocketServer.ThreadingTCPServer import get_request [as 别名]
def get_request(self):
client_sock, client_addr = ThreadingTCPServer.get_request(self)
self.clients[client_addr] = ClientStruct(client_sock)
print 'self.clients', pformat(self.clients)
return client_sock, client_addr