Hello, I am relatively new to python and Panda, and have been trying some of the examples from the manual. However, when I got to networking part, I noticed a strange behaviour. I have the client code that goes like the one in the manual:
self.cManager = QueuedConnectionManager()
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager,0)
ip_address="localhost" #tried with other random addresses, too
port_address=9099 #No-other TCP/IP services are using this port
timeout_in_ms=3000 # 3 seconds
self.tcpSocket = self.cManager.openTCPClientConnection(ip_address, port_address, timeout_in_ms)
if self.tcpSocket:
print self.tcpSocket, "is active"
self.cReader.addConnection(self.tcpSocket) # receive messages from server
else:
print "Could not connect to server."
I also have a server set up to listen at port 9099, and if both programs are executed, the server “sees” the client, and they can communicate with each other.
The funny thing is that if I run just the client without starting a server first (confirmed by no results from netstat -l | grep 9099), it doesn’t see any problem and still acts as if the server was there, giving me the message:
<libpanda.Connection object at 0x31343c8> is active
The client can also send messages through the connection, although obviously it does not receive any reply because the server does not exist.
Does anyone else have this problem? Or am I simply checking for connection in a wrong way?
In case it was related somehow to my operating system, I am using Ubuntu 9.10 with 2.6.31-23 kernel (x86_64), and a manually compiled panda3d-1.7.2(stable).
Any help would be greatly appreciated. Panda seems one of the nicest engines I have worked with so far and I would like to learn some more!