Add -j option to bind to specific address

Before this patch, the binding of the listening sockets was hardcoded to
a local IP.

Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec
This commit is contained in:
Pau Espin Pedrol
2017-08-16 16:53:23 +02:00
parent d49a6aa136
commit 8c80095017
6 changed files with 40 additions and 28 deletions

View File

@@ -37,7 +37,7 @@ static const int gNumToSend = 10;
void *testReaderIP(void *)
{
UDPSocket readSocket(5934, "localhost", 5061);
UDPSocket readSocket("127.0.0.1", 5934, "localhost", 5061);
readSocket.nonblocking();
int rc = 0;
while (rc<gNumToSend) {
@@ -82,7 +82,7 @@ int main(int argc, char * argv[] )
Thread readerThreadUnix;
readerThreadUnix.start(testReaderUnix,NULL);
UDPSocket socket1(5061, "127.0.0.1",5934);
UDPSocket socket1("127.0.0.1", 5061, "127.0.0.1", 5934);
UDDSocket socket1U("testSource","testDestination");
COUT("socket1: " << socket1.port());