summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2011-10-03 17:09:06 +0200
committerMartin Lucina <martin@lucina.net>2012-01-23 08:54:33 +0100
commitc3363afa881b46f3df8a6b72ed15cfbac18f4713 (patch)
tree832e8075a038b49f81e8a7635344f1647007fd15 /src/socket_base.cpp
parent88f712b4a31c95caef4f34c4ec65793c392314a6 (diff)
parent978e33ba253a997b41b331b449b474a5cee7bccc (diff)
Imported Debian patch 2.1.10-1debian/2.1.10-1
Diffstat (limited to 'src/socket_base.cpp')
-rw-r--r--src/socket_base.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 2167b0b..335a858 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -364,10 +364,23 @@ int zmq::socket_base_t::connect (const char *addr_)
if (rc != 0)
return -1;
+ // Checks that protocol is valid and supported on this system
rc = check_protocol (protocol);
if (rc != 0)
return -1;
+ // Parsed address for validation
+ sockaddr_storage addr;
+ socklen_t addr_len;
+
+ if (protocol == "tcp")
+ rc = resolve_ip_hostname (&addr, &addr_len, address.c_str ());
+ else
+ if (protocol == "ipc")
+ rc = resolve_local_path (&addr, &addr_len, address.c_str ());
+ if (rc != 0)
+ return -1;
+
if (protocol == "inproc" || protocol == "sys") {
// TODO: inproc connect is specific with respect to creating pipes