diff --git a/panda/src/net/Sources.pp b/panda/src/net/Sources.pp index 2ef388fbdd..e393966786 100644 --- a/panda/src/net/Sources.pp +++ b/panda/src/net/Sources.pp @@ -37,6 +37,7 @@ #begin test_bin_target #define TARGET test_datagram #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ test_datagram.cxx @@ -46,6 +47,7 @@ #begin test_bin_target #define TARGET test_spam_client #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ datagram_ui.cxx datagram_ui.h test_spam_client.cxx @@ -55,6 +57,7 @@ #begin test_bin_target #define TARGET test_spam_server #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ datagram_ui.cxx datagram_ui.h test_spam_server.cxx @@ -64,6 +67,7 @@ #begin test_bin_target #define TARGET test_tcp_client #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ datagram_ui.cxx datagram_ui.h test_tcp_client.cxx @@ -73,6 +77,7 @@ #begin test_bin_target #define TARGET test_tcp_server #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ datagram_ui.cxx datagram_ui.h test_tcp_server.cxx @@ -82,6 +87,7 @@ #begin test_bin_target #define TARGET test_udp #define LOCAL_LIBS net + #define OTHER_LIBS pystub #define SOURCES \ datagram_ui.cxx datagram_ui.h test_udp.cxx diff --git a/panda/src/net/connectionManager.cxx b/panda/src/net/connectionManager.cxx index f59257dd5b..960db0f083 100644 --- a/panda/src/net/connectionManager.cxx +++ b/panda/src/net/connectionManager.cxx @@ -48,11 +48,16 @@ ConnectionManager:: // Function: ConnectionManager::open_UDP_connection // Access: Public // Description: Opens a socket for sending and/or receiving UDP -// packets. If the port is non-negative, it will be -// bound to the connection; this is primarily a useful -// to do when the UDP connection will be used for -// reading. Use a ConnectionReader and -// ConnectionWriter to handle the actual communication. +// packets. If the port number is negative, it will not +// be bound to a socket; this is generally a pointless +// thing to do. If the port number is zero, a random +// socket will be chosen. Otherwise, the specified +// port number is used. Normally, you don't care what +// port a UDP connection is opened on, so you should use +// the default value of zero. +// +// Use a ConnectionReader and ConnectionWriter to handle +// the actual communication. //////////////////////////////////////////////////////////////////// PT(Connection) ConnectionManager:: open_UDP_connection(int port) { diff --git a/panda/src/net/connectionManager.h b/panda/src/net/connectionManager.h index fbc3c7a043..7aabbf19cc 100644 --- a/panda/src/net/connectionManager.h +++ b/panda/src/net/connectionManager.h @@ -40,7 +40,7 @@ public: ConnectionManager(); virtual ~ConnectionManager(); - PT(Connection) open_UDP_connection(int port = -1); + PT(Connection) open_UDP_connection(int port = 0); PT(Connection) open_TCP_server_rendezvous(int port, int backlog); PT(Connection) open_TCP_client_connection(const NetAddress &address, diff --git a/panda/src/net/test_udp.cxx b/panda/src/net/test_udp.cxx index 1e6c4a746e..97f237102a 100644 --- a/panda/src/net/test_udp.cxx +++ b/panda/src/net/test_udp.cxx @@ -35,7 +35,9 @@ main(int argc, char *argv[]) { exit(1); } - nout << "Successfully opened UDP connection on port " << port << "\n"; + nout << "Successfully opened UDP connection on port " + << c->get_address().get_port() << " and IP " + << c->get_address().get_ip() << "\n"; RecentConnectionReader reader(&cm); reader.add_connection(c);