Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
51ad8568
Commit
51ad8568
authored
Oct 25, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added connect_to()
parent
6bf4a648
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
bridge.h
dlib/bridge/bridge.h
+25
-0
bridge_abstract.h
dlib/bridge/bridge_abstract.h
+11
-0
No files found.
dlib/bridge/bridge.h
View file @
51ad8568
...
...
@@ -43,6 +43,31 @@ namespace dlib
const
unsigned
short
port
;
};
inline
connect_to_ip_and_port
connect_to
(
const
network_address
&
addr
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
addr
.
port
!=
0
,
"
\t
connect_to_ip_and_port()"
<<
"
\n\t
The TCP port to connect to can't be 0."
<<
"
\n\t
addr.port: "
<<
addr
.
port
);
if
(
is_ip_address
(
addr
.
host_address
))
{
return
connect_to_ip_and_port
(
addr
.
host_address
,
addr
.
port
);
}
else
{
std
::
string
ip
;
if
(
hostname_to_ip
(
addr
.
host_address
,
ip
))
throw
socket_error
(
ERESOLVE
,
"unable to resolve '"
+
addr
.
host_address
+
"' in connect_to()"
);
return
connect_to_ip_and_port
(
ip
,
addr
.
port
);
}
}
struct
listen_on_port
{
listen_on_port
(
...
...
dlib/bridge/bridge_abstract.h
View file @
51ad8568
...
...
@@ -27,6 +27,17 @@ namespace dlib
!*/
};
connect_to_ip_and_port
connect_to
(
const
network_address
&
addr
);
/*!
requires
- addr.port != 0
ensures
- converts the given network_address object into a connect_to_ip_and_port
object.
!*/
struct
listen_on_port
{
listen_on_port
(
...
...
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