MCPcopy Create free account
hub / github.com/esnet/iperf / netdial

Function netdial

src/net.c:267–288  ·  view source on GitHub ↗

make connection to server */

Source from the content-addressed store, hash-verified

265
266/* make connection to server */
267int
268netdial(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, int timeout)
269{
270 struct addrinfo *server_res = NULL;
271 int s, saved_errno;
272
273 s = create_socket(domain, proto, 0, local, bind_dev, local_port, server, port, &server_res);
274 if (s < 0) {
275 return -1;
276 }
277
278 if (timeout_connect(s, (struct sockaddr *) server_res->ai_addr, server_res->ai_addrlen, timeout) < 0 && errno != EINPROGRESS) {
279 saved_errno = errno;
280 close(s);
281 freeaddrinfo(server_res);
282 errno = saved_errno;
283 return -1;
284 }
285
286 freeaddrinfo(server_res);
287 return s;
288}
289
290/***************************************************************/
291

Callers 2

iperf_connectFunction · 0.85
iperf_udp_connectFunction · 0.85

Calls 2

create_socketFunction · 0.85
timeout_connectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…