def tcpListenerTask(self, task): """ Accept new incoming connection from clients, related to TCP """ # Handle new connection if self.tcpListener.newConnectionAvailable(): rendezvous = PointerToConnection() netAddress = NetAddress() newConnection = PointerToConnection() if self.tcpListener.getNewConnection(rendezvous, netAddress, newConnection): newConnection = newConnection.p() # Tell the reader about the new TCP connection self.tcpReader.addConnection(newConnection) # Handle the connection depending on persistent or not if self.core.server.isPersistent: self.core.handleConnection(generateUUID(), newConnection, netAddress) else: self.core.createPlayerObject(generateUUID(),newConnection, netAddress) print ("Server: New Connection from -", str(netAddress.getIpString())) else: print ("Server: Connection Failed from -", str(netAddress.getIpString())) return Task.cont
def tcpListenerTask(self, task): """ Accept new incoming connection from clients, related to TCP """ # Handle new connection if self.tcpListener.newConnectionAvailable(): rendezvous = PointerToConnection() netAddress = NetAddress() newConnection = PointerToConnection() if self.tcpListener.getNewConnection(rendezvous, netAddress, newConnection): newConnection = newConnection.p() # Tell the reader about the new TCP connection self.tcpReader.addConnection(newConnection) # Handle the connection depending on persistent or not if self.core.server.isPersistent: self.core.handleConnection(generateUUID(), newConnection, netAddress) else: self.core.createPlayerObject(generateUUID(), newConnection, netAddress) print("Server: New Connection from -", str(netAddress.getIpString())) else: print("Server: Connection Failed from -", str(netAddress.getIpString())) return Task.cont
def tsk_listener(self, task): if not self.c_listener.newConnectionAvailable(): return task.cont net_address = NetAddress() new_connection = PointerToConnection() args = PointerToConnection(), net_address, new_connection if not self.c_listener.get_new_connection(*args): return task.cont self.connections.append(new_connection.p()) self.c_reader.add_connection(self.connections[-1]) self.connection_cb(net_address.get_ip_string()) msg = 'received a connection from ' + net_address.getIpString() eng.log_mgr.log(msg) return task.cont