本文整理汇总了Python中panda3d.core.QueuedConnectionManager类的典型用法代码示例。如果您正苦于以下问题:Python QueuedConnectionManager类的具体用法?Python QueuedConnectionManager怎么用?Python QueuedConnectionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QueuedConnectionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, worldMgr, connectionObj):
self.connectionObj = connectionObj
if connectionObj.cManager != None:
self.cManager = connectionObj.cManager
else:
self.cManager = QueuedConnectionManager()
if connectionObj.cListener != None:
self.cListener = connectionObj.cListener
else:
self.cListener = QueuedConnectionManager()
if connectionObj.cReader != None:
self.cReader = connectionObj.cReader
else:
self.cReader = QueuedConnectionManager()
if connectionObj.cWriter != None:
self.cWriter = connectionObj.cWriter
else:
self.cWriter = QueuedConnectionManager()
if connectionObj.connection != None:
self.connection = connectionObj.connection
else:
self.connection = self.cManager.openTCPClientConnection(Constants.SERVER_IP,
Constants.SERVER_PORT,
1000)
if self.connection:
self.cReader.addConnection(self.connection)
self.rqTable = ServerRequestTable()
self.rsTable = ServerResponseTable()
self.worldMgr = worldMgr
self.world = worldMgr.gameWorld
示例2: __init__
def __init__(self):
self.activeConnections = [] # lists all connections
self.players = {} # keys are the players logins, values are the players datagram connections
self.parties = {} # keys are the parties names, values are dicts representing parties data
self.sessions = {} # keys are the datagram connections, values are dicts storing the characters of the player and its party
self.playersinlobby = [] # lists players in the party screen
self.charid = 0 # used for random team generation
self.chars = [] # lists of dicts representing characters data
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cReader.setTcpHeaderSize(4)
self.send = Send(self.cManager)
port = 3001
if len(sys.argv) > 1:
port = sys.argv[1]
self.tcpSocket = self.cManager.openTCPServerRendezvous(port, 10)
self.cListener.addConnection(self.tcpSocket)
print("Server listening on port", port)
taskMgr.add(self.tskListenerPolling, "Poll the connection listener", -39)
taskMgr.add(self.tskReaderPolling, "Poll the connection reader", -40)
示例3: __init__
def __init__(self):
print 'Loading Login...'
# self.cManager = ConnectionManager()
# self.startConnection()
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
frame = DirectFrame(frameColor=(0, 0, 0, 1), #(R,G,B,A)
frameSize=(-1, 1, -1, 1),#(Left,Right,Bottom,Top)
pos=(-0.5, 0, 0.5))
self.connection = self.cManager.openTCPClientConnection(Constants.SERVER_IP,
Constants.SERVER_PORT,
1000)
if self.connection:
self.cReader.addConnection(self.connection)
taskMgr.add(self.updateRoutine, 'updateRoutine-Connection', -39)
taskMgr.doMethodLater(5, self.checkConnection, 'checkConnection')
self.createLoginWindow()
示例4: __init__
def __init__(self):
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
host = "localhost"
port = 9898
self.connection = self.cManager.openTCPClientConnection(host, port, 10000)
#self.received = 1
#store a dictionary of active players with username player as key value pair
#the dictionary also contain a special player named panda
self.players = {}
#for display the list on the screen
self.temp = []
#store a dictionary of playerObject
self.playerObjects = {}
self.render = render
self.loginSuccessful = False
self.isMoving = False
self.justStoping = False
self.targetPlayer = None
if self.connection:
self.cReader.addConnection(self.connection)
taskMgr.add(self.updateRoutine, 'updateRoutine')
#taskMgr.doMethodLater(0.5, self.updateRoutine, 'updateRoutine')
#taskMgr.add(self.updatePandaAttack, 'updatePandaAttack')
#taskMgr.doMethodLater(3, self.updatePandaAttack, 'updatePandaAttack')
self.loginRegister()
示例5: __init__
def __init__(self, base, host, port):
self.base = base
self.host = host
self.port = port
self._conn = None
self._retry_elapsed = 0
self._retry_next = 0
self._data_last_received = 0
self.manager = QueuedConnectionManager()
self.reader = QueuedConnectionReader(
self.manager,
0, # number of threads
)
# we're using our own protocol so we don't want panda reading our headers and getting
# all foobared by it (not setting raw mode causes `dataAvailable` to block
# once there is actually data to process)
self.reader.setRawMode(True)
self.writer = ConnectionWriter(
self.manager,
0, # number of threads
)
示例6: __init__
def __init__(self):
ShowBase.__init__(self)
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.player = Player()
self.opponents = dict()
self.logStat = -1
host = "localhost"
port = 9252
self.connection = self.cManager.openTCPClientConnection(host, port, 10000)
self.received = 1
self.playersText = []
if self.connection:
self.cReader.addConnection(self.connection)
taskMgr.add(self.updateRoutine, 'updateRoutine')
taskMgr.add(self.login, 'login')
#taskMgr.doMethodLater(3, self.updateRoutine, 'updateRoutine')
taskMgr.doMethodLater(.1, self.heartbeat, 'heartbeat')
self.accept("q", self.listPlayers)
self.accept("q-up", self.delistPlayers)
self.accept("escape", self.disconnect)
self.accept("arrow_up", self.move)
示例7: setupTCP
def setupTCP(self):
self.tcpManager = QueuedConnectionManager()
self.tcpReader = QueuedConnectionReader(self.tcpManager, 0)
self.tcpWriter = ConnectionWriter(self.tcpManager, 0)
self.tcpListener = QueuedConnectionListener(self.tcpManager, 0)
self.tcpSocket = self.tcpManager.openTCPServerRendezvous(self.config.TCPPORT, self.config.BACKLOG)
self.tcpListener.addConnection(self.tcpSocket)
print ("Started Server on: ", self.config.HOSTNAME, self.config.TCPPORT)
示例8: setupTCP
def setupTCP(self):
self.tcpManager = QueuedConnectionManager()
self.tcpReader = QueuedConnectionReader(self.tcpManager, 0)
self.tcpWriter = ConnectionWriter(self.tcpManager, 0)
self.tcpListener = QueuedConnectionListener(self.tcpManager, 0)
self.tcpSocket = self.tcpManager.openTCPServerRendezvous(self.tcpport, self.backlog)
self.tcpListener.addConnection(self.tcpSocket)
print ("Started Server on: ", self.hostname, self.tcpport)
示例9: __init__
def __init__(self):
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.connection = None
示例10: __init__
def __init__(self):
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.rqTable = ServerRequestTable()
self.rsTable = ServerResponseTable()
self.connection = None
示例11: init
def init(self, port=2000, server="127.0.0.1", serverPort=1999, backlog=1000, compress=False):
self.packetCount = 0
self.port = port
self.serverPort = serverPort
self.serverIP = server
self.serverAddress = NetAddress()
self.serverAddress.setHost(server, serverPort)
self.cManager = QueuedConnectionManager()
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.udpSocket = self.cManager.openUDPConnection(self.port)
self.cReader.addConnection(self.udpSocket)
示例12: attemptLogin
def attemptLogin(self):
# checks to make sure the user inputed a username and password:
# if they didn't it will spit out an error message
# if they did, it will try to connect to the login server
# (under construction)
if(self.usernameBox.get() == ""):
if(self.passwordBox.get() == ""):
self.updateStatus("ERROR: You must enter a username and password before logging in.")
else:
self.updateStatus("ERROR: You must specify a username")
self.passwordBox['focus'] = 0
self.usernameBox['focus'] = 1
elif(self.passwordBox.get() == ""):
self.updateStatus("ERROR: You must enter a password")
self.usernameBox['focus'] = 0
self.passwordBox['focus'] = 1
elif(self.password2Box.get() == ""):
self.updateStatus("ERROR: You must confirm the password")
self.passwordBox['focus'] = 0
self.password2Box['focus'] = 1
elif(self.passwordBox.get() != self.password2Box.get()):
self.updateStatus("ERROR: Wrong confirmed password, please enter password again")
self.passwordBox.set("")
self.password2Box.set("")
self.passwordBox['focus'] = 1
self.password2Box['focus'] = 0
self.usernameBox['focus'] = 0
else:
self.updateStatus("Attempting to login...")
print "Attempting to connect to Server with credentials: (" + self.usernameBox.get() + ", " + self.passwordBox.get() + ")"
# this is where the networking code will get put in
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
HOST = "localhost";
PORT = 1234;
self.connection = self.cManager.openTCPClientConnection(HOST, PORT, 10000)
self.received = 1
if self.connection:
self.cReader.addConnection(self.connection)
#taskMgr.add(self.updateRoutine, 'updateRoutine')
taskMgr.doMethodLater(3, self.updateRoutine, 'updateRoutine')
示例13: connection_open
def connection_open(self):
self.cManager = QueuedConnectionManager()
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager,0)
self.activeConnections=[] # We'll want to keep track of these later
self.cListener = QueuedConnectionListener(self.cManager, 0)
port_address=9099 #No-other TCP/IP services are using this port
backlog=1000 #If we ignore 1,000 connection attempts, something is wrong!
self.tcpSocket = self.cManager.openTCPServerRendezvous(port_address,backlog)
self.cListener.addConnection(self.tcpSocket)
print "Network Connection Opened"
taskMgr.add(self.tskListenerPolling,"Poll the connection listener",-39)
taskMgr.add(self.tskReaderPolling,"Poll the connection reader",-40)
示例14: __init__
def __init__(self):
ShowBase.__init__(self)
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
host = "localhost"
port = 9252
self.connection = self.cManager.openTCPClientConnection(host, port, 10000)
self.received = 1
if self.connection:
self.cReader.addConnection(self.connection)
taskMgr.add(self.updateRoutine, 'updateRoutine')
taskMgr.add(self.message, 'message')
示例15: init
def init(self, port=1999, backlog=1000, compress=False):
log.debug("Initing Network System")
self.accept("broadcastData", self.broadcastData)
self.port = port
self.backlog = backlog
self.compress = compress
self.cManager = QueuedConnectionManager()
self.cReader = QueuedConnectionReader(self.cManager, 0)
#self.cReader.setRawMode(True)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.udpSocket = self.cManager.openUDPConnection(self.port)
self.cReader.addConnection(self.udpSocket)
self.activePlayers = [] # PlayerComponent
self.activeConnections = {} # {NetAddress : PlayerComponent}
self.lastAck = {} # {NetAddress: time}
self.startPolling()
self.accept("shipGenerated", self.shipGenerated)