Properly close sockets

This commit is contained in:
Ruihan Li
2024-07-23 23:03:10 +08:00
committed by Tate, Hongliang Tian
parent 94b23e077d
commit 328ce9e92c
11 changed files with 162 additions and 95 deletions

View File

@ -131,7 +131,7 @@ int main(void)
for (backlog = 0; backlog <= MAX_TEST_BACKLOG; ++backlog) {
// Avoid "bind: Address already in use"
addr.sin_port = htons(8080 + backlog);
addr.sin_port = htons(10000 + backlog);
err = test_listen_backlog(&addr, backlog);
if (err != 0)

View File

@ -265,7 +265,7 @@ int main(void)
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(8080);
addr.sin_port = htons(9999);
if (inet_aton("127.0.0.1", &addr.sin_addr) < 0) {
fprintf(stderr, "inet_aton cannot parse 127.0.0.1\n");
return -1;