MCPcopy Create free account
hub / github.com/davisking/dlib / connect

Function connect

dlib/sockets/sockets_extensions.cpp:101–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99// ----------------------------------------------------------------------------------------
100
101 connection* connect (
102 const std::string& host_or_ip,
103 unsigned short port
104 )
105 {
106 std::string ip;
107 connection* con;
108 if (is_ip_address(host_or_ip))
109 {
110 ip = host_or_ip;
111 }
112 else
113 {
114 if( hostname_to_ip(host_or_ip,ip))
115 throw socket_error(ERESOLVE,"unable to resolve '" + host_or_ip + "' in connect()");
116 }
117
118 if(create_connection(con,port,ip))
119 {
120 std::ostringstream sout;
121 sout << "unable to connect to '" << host_or_ip << ":" << port << "'";
122 throw socket_error(sout.str());
123 }
124
125 return con;
126 }
127
128// ----------------------------------------------------------------------------------------
129

Callers 9

threadFunction · 0.85
create_connectionFunction · 0.85
create_connectionFunction · 0.85
grab_urlMethod · 0.85
bsp_conMethod · 0.85
write_threadMethod · 0.85
no_write_threadMethod · 0.85
openMethod · 0.85
mainFunction · 0.85

Calls 9

is_ip_addressFunction · 0.85
socket_errorClass · 0.85
get_timestampMethod · 0.80
hostname_to_ipFunction · 0.70
create_connectionFunction · 0.70
create_new_threadFunction · 0.50
strMethod · 0.45
wait_or_timeoutMethod · 0.45
broadcastMethod · 0.45

Tested by 2

write_threadMethod · 0.68
no_write_threadMethod · 0.68