summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-05-26 16:56:25 +0000
committerDavid Robillard <d@drobilla.net>2015-05-26 16:56:25 +0000
commit738a358995b32bcea90e17bbe1797c64c13e0ac3 (patch)
treee001499b2635f77db908cd86c130e402f2e61e32
parent788fa47e103cd2dcdc9d33dda29b3b904c08d818 (diff)
downloadraul-738a358995b32bcea90e17bbe1797c64c13e0ac3.tar.gz
raul-738a358995b32bcea90e17bbe1797c64c13e0ac3.tar.bz2
raul-738a358995b32bcea90e17bbe1797c64c13e0ac3.zip
Listen for TCP connections on all interfaces.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@5689 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--raul/Socket.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/raul/Socket.hpp b/raul/Socket.hpp
index e16b883..84c40af 100644
--- a/raul/Socket.hpp
+++ b/raul/Socket.hpp
@@ -56,7 +56,8 @@ public:
~Socket();
/** Bind a server socket to an address.
- * @param uri Address URI, e.g. unix:///tmp/foo or tcp://somehost:1234
+ * @param uri Address URI, e.g. unix:///tmp/foo, tcp://somehost:1234, or
+ * tcp://*:1234 to listen on all interfaces.
* @return True on success.
*/
bool bind(const Raul::URI& uri);
@@ -165,8 +166,11 @@ Socket::set_addr(const Raul::URI& uri)
return false;
}
- const std::string host = authority.substr(0, port_sep);
+ std::string host = authority.substr(0, port_sep);
const std::string port = authority.substr(port_sep + 1).c_str();
+ if (host.empty() || host == "*") {
+ host = "0.0.0.0"; // INADDR_ANY
+ }
struct addrinfo* ainfo;
int st = 0;