当前位置: 首页>>代码示例>>Python>>正文


Python core.QueuedConnectionReader类代码示例

本文整理汇总了Python中panda3d.core.QueuedConnectionReader的典型用法代码示例。如果您正苦于以下问题:Python QueuedConnectionReader类的具体用法?Python QueuedConnectionReader怎么用?Python QueuedConnectionReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QueuedConnectionReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __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)
开发者ID:gaconkzk,项目名称:tethical,代码行数:26,代码来源:main.py

示例2: __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()
开发者ID:jaimeh,项目名称:hw2-cs454,代码行数:30,代码来源:login.py

示例3: __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()
开发者ID:qiaoma,项目名称:MMOG,代码行数:34,代码来源:ClientApplication.py

示例4: __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
        )
开发者ID:atatsu,项目名称:panda3d-fun,代码行数:27,代码来源:client.py

示例5: __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)
开发者ID:jaimodha,项目名称:MMOG,代码行数:31,代码来源:TestingClient.py

示例6: 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)
开发者ID:grimfang,项目名称:grim_net,代码行数:9,代码来源:TCP.py

示例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.tcpport, self.backlog)
        self.tcpListener.addConnection(self.tcpSocket)
        print ("Started Server on: ", self.hostname, self.tcpport)
开发者ID:grimfang,项目名称:grim_net,代码行数:9,代码来源:TCP_Socket.py

示例8: __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
开发者ID:rodthung,项目名称:CS594_gameprogramming,代码行数:9,代码来源:client.py

示例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.rqTable = ServerRequestTable()
        self.rsTable = ServerResponseTable()
        
        self.connection = None
开发者ID:jaimodha,项目名称:MMOG,代码行数:11,代码来源:ConnectionManager.py

示例10: 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)
开发者ID:croxis,项目名称:itf,代码行数:13,代码来源:client_net.py

示例11: 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')
开发者ID:burgui,项目名称:HW2,代码行数:50,代码来源:Register.py

示例12: 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)
开发者ID:HepcatNZ,项目名称:EmpiresOfSuburbia,代码行数:15,代码来源:TimNetwork.py

示例13: __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')
开发者ID:jaimodha,项目名称:MMOG,代码行数:18,代码来源:TestingClient.py

示例14: 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)
开发者ID:croxis,项目名称:itf,代码行数:20,代码来源:server_net.py

示例15: __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')
			
			
		
		print 'Hello You Are Now Connected To The Server'
		#self.heartbeat()
		self.options()
开发者ID:jaimeh,项目名称:hw2-cs454,代码行数:23,代码来源:chat.py


注:本文中的panda3d.core.QueuedConnectionReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。