diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c index 588ca97..772a403 100644 --- a/src/rtl_tcp.c +++ b/src/rtl_tcp.c @@ -571,7 +571,7 @@ int main(int argc, char **argv) setsockopt(listensocket, SOL_SOCKET, SO_REUSEADDR, (char *)&r, sizeof(int)); setsockopt(listensocket, SOL_SOCKET, SO_LINGER, (char *)&ling, sizeof(ling)); - if (bind(listensocket, (struct sockaddr *)&local, sizeof(local))) + if (bind(listensocket, (struct sockaddr *)&local, aiHead->ai_addrlen)) fprintf(stderr, "rtl_tcp bind error: %s", strerror(errno)); else break;