diff options
-rw-r--r-- | tests/CommonLibs/SocketsTest.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/CommonLibs/SocketsTest.cpp b/tests/CommonLibs/SocketsTest.cpp index 235b8f3..9a7d6f0 100644 --- a/tests/CommonLibs/SocketsTest.cpp +++ b/tests/CommonLibs/SocketsTest.cpp @@ -35,14 +35,14 @@ static const int gNumToSend = 10; -void *testReaderIP(void *) +void *testReaderIP(void *param) { - UDPSocket readSocket("127.0.0.1", 5934, "localhost", 5061); - readSocket.nonblocking(); + UDPSocket *readSocket = (UDPSocket *)param; + readSocket->nonblocking(); int rc = 0; while (rc<gNumToSend) { char buf[MAX_UDP_LENGTH]; - int count = readSocket.read(buf, MAX_UDP_LENGTH); + int count = readSocket->read(buf, MAX_UDP_LENGTH); if (count>0) { CERR("read: " << buf); rc++; @@ -56,12 +56,13 @@ void *testReaderIP(void *) int main(int argc, char * argv[] ) { - Thread readerThreadIP; - readerThreadIP.start(testReaderIP,NULL); + UDPSocket readSocket("127.0.0.1", 0); + UDPSocket socket1("127.0.0.1", 0, "localhost", readSocket.port()); - UDPSocket socket1("127.0.0.1", 5061, "127.0.0.1", 5934); + CERR("socket1: " << socket1.port() << ", readSocket: " << readSocket.port()); - CERR("socket1: " << socket1.port()); + Thread readerThreadIP; + readerThreadIP.start(testReaderIP, &readSocket); // give the readers time to open sleep(1); |