summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
diff options
context:
space:
mode:
authorMartin Lucina <martin@lucina.net>2012-01-23 08:54:31 +0100
committerMartin Lucina <martin@lucina.net>2012-01-23 08:54:31 +0100
commit978e33ba253a997b41b331b449b474a5cee7bccc (patch)
tree68b0709e1ebb04bf7fd102a7783e3f93dd52cc8c /src/socket_base.cpp
parent75af6aed482ab16997c1388fe801f74d11ec12a4 (diff)
Imported Upstream version 2.1.10upstream/2.1.10
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