introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),

use them where appropriate. 200 bytes saved
This commit is contained in:
Denis Vlasenko
2006-11-22 23:22:06 +00:00
parent b40bdb383a
commit 48237b0c88
16 changed files with 40 additions and 42 deletions

View File

@@ -85,8 +85,7 @@ int nc_main(int argc, char **argv)
if (!cfd) {
sfd = xsocket(AF_INET, SOCK_STREAM, 0);
fcntl(sfd, F_SETFD, FD_CLOEXEC);
opt = 1;
setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
setsockopt_reuseaddr(sfd);
address.sin_family = AF_INET;
// Set local port.