aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs/Sockets.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-16 16:53:23 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-16 17:06:54 +0200
commit8c80095017f693a9e96b9118e33786f8887ffe0c (patch)
tree88a879b9daea3cb71c29f983eca65d6b92910d6e /CommonLibs/Sockets.h
parentd49a6aa136efcb9106abfa432e148e643db7ac1e (diff)
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
Diffstat (limited to 'CommonLibs/Sockets.h')
-rw-r--r--CommonLibs/Sockets.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/CommonLibs/Sockets.h b/CommonLibs/Sockets.h
index 0a70269..8312843 100644
--- a/CommonLibs/Sockets.h
+++ b/CommonLibs/Sockets.h
@@ -144,11 +144,11 @@ class UDPSocket : public DatagramSocket {
public:
/** Open a USP socket with an OS-assigned port and no default destination. */
- UDPSocket( unsigned short localPort=0);
+ UDPSocket(const char *localIP, unsigned short localPort);
/** Given a full specification, open the socket and set the dest address. */
- UDPSocket( unsigned short localPort,
- const char * remoteIP, unsigned short remotePort);
+ UDPSocket(const char *localIP, unsigned short localPort,
+ const char *remoteIP, unsigned short remotePort);
/** Set the destination port. */
void destination( unsigned short wDestPort, const char * wDestIP );
@@ -157,7 +157,7 @@ public:
unsigned short port() const;
/** Open and bind the UDP socket to a local port. */
- void open(unsigned short localPort=0);
+ void open(unsigned short localPort=0, const char *wlocalIP="127.0.0.1");
/** Give the return address of the most recently received packet. */
const struct sockaddr_in* source() const { return (const struct sockaddr_in*)mSource; }