Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
454f43a4
Commit
454f43a4
authored
Jan 23, 2010
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IP address resolving on Win32 fixed
parent
df4548aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
ip.cpp
src/ip.cpp
+14
-6
No files found.
src/ip.cpp
View file @
454f43a4
...
...
@@ -185,7 +185,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
}
// Separate the name/port.
std
::
string
i
nter
face
(
interface_
,
delimiter
-
interface_
);
std
::
string
iface
(
interface_
,
delimiter
-
interface_
);
std
::
string
service
(
delimiter
+
1
);
// Initialize the output parameter.
...
...
@@ -196,7 +196,6 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
ip4_addr
.
sin_family
=
AF_INET
;
ip4_addr
.
sin_port
=
htons
((
uint16_t
)
atoi
(
service
.
c_str
()));
// Initialize temporary output pointers with ip4_addr
sockaddr
*
out_addr
=
(
sockaddr
*
)
&
ip4_addr
;
size_t
out_addrlen
=
sizeof
(
ip4_addr
);
...
...
@@ -208,7 +207,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
}
// * resolves to INADDR_ANY.
if
(
i
nter
face
.
compare
(
"*"
)
==
0
)
{
if
(
iface
.
compare
(
"*"
)
==
0
)
{
ip4_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
zmq_assert
(
out_addrlen
<=
sizeof
(
*
addr_
));
memcpy
(
addr_
,
out_addr
,
out_addrlen
);
...
...
@@ -217,7 +216,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
}
// Try to resolve the string as a NIC name.
int
rc
=
resolve_nic_name
(
&
ip4_addr
.
sin_addr
,
i
nter
face
.
c_str
());
int
rc
=
resolve_nic_name
(
&
ip4_addr
.
sin_addr
,
iface
.
c_str
());
if
(
rc
!=
0
&&
errno
!=
ENODEV
)
return
rc
;
if
(
rc
==
0
)
{
...
...
@@ -227,15 +226,24 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_,
return
0
;
}
#if defined ZMQ_HAVE_WINDOWS
// Old versions of Windows don't support inet_pton
// so let's rather use inet_addr instead.
ip4_addr
.
sin_addr
.
S_un
.
S_addr
=
inet_addr
(
iface
.
c_str
());
if
(
ip4_addr
.
sin_addr
.
S_un
.
S_addr
==
INADDR_NONE
)
{
errno
=
ENODEV
;
return
-
1
;
}
#else
// There's no such interface name. Assume literal address.
rc
=
inet_pton
(
AF_INET
,
interface
.
c_str
(),
&
ip4_addr
.
sin_addr
);
rc
=
inet_pton
(
AF_INET
,
iface
.
c_str
(),
&
ip4_addr
.
sin_addr
);
if
(
rc
==
0
)
{
errno
=
ENODEV
;
return
-
1
;
}
if
(
rc
<
0
)
return
-
1
;
#endif
zmq_assert
(
out_addrlen
<=
sizeof
(
*
addr_
));
memcpy
(
addr_
,
out_addr
,
out_addrlen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment