3 #include <sys/socket.h>
4 #include <netinet/in.h>
7 make_socket (uint16_t port
)
10 struct sockaddr_in name
;
12 /* Create the socket. */
13 sock
= socket (PF_INET
, SOCK_STREAM
, 0);
20 /* Give the socket a name. */
21 name
.sin_family
= AF_INET
;
22 name
.sin_port
= htons (port
);
23 name
.sin_addr
.s_addr
= htonl (INADDR_ANY
);
24 if (bind (sock
, (struct sockaddr
*) &name
, sizeof (name
)) < 0)