Panda 1.8.0 on arch linux
I’m trying to use a dict to map netaddresses to player entities to map clients to players. However the netaddress in the dictionary gets reset to 0.0.0.0. Any suggestion how to stop this, or a better way to do virtual connections for udp?
The pseudocode:
class NetworkSystem(sandbox.EntitySystem):
def init(self, port=1999, backlog=1000, compress=False):
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)
self.activeConnections = {}
def run(self):
if self.cReader.dataAvailable():
datagram = NetDatagram()
if self.cReader.getData(datagram):
myIterator = PyDatagramIterator(datagram)
msgID = myIterator.getUint8()
if msgID == protocol.LOGIN:
self.activeConnections[datagram.getAddress()] = Player()
elif msgID == protocol.MOVE:
print self.activeConnections
And activeConnections list {0.0.0.0: player}
Thanks for any help!
[/code]