Stuff
public text v1 · immutable memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = getAddress(interface);
addr.sin_port = htons(port);
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
&reuse_addr, sizeof(reuse_addr)) < 0) {
error("Unable to setsockopt");
}
int result = 0;
result = bind(sock, (struct sockaddr*)&addr, sizeof(addr));
if (result < 0) {
char *message;
sprintf(message, "Unable to bind to listen port (error code %d)", result);
error(message);
}