Open Hanaasagi opened 1 year ago
From https://github.com/oven-sh/bun/issues/5315
examples/http_server.c
https://github.com/uNetworking/uSockets/blob/ac4e90e4d2ad674db903accc5f3abc408a6bc5d8/examples/http_server.c#L123
change to bind localhost:3000
localhost:3000
struct us_listen_socket_t *listen_socket = us_socket_context_listen(SSL, http_context, "localhost", 3000, 0, sizeof(struct http_socket));
debian:sid-slim
http_server
root@5b4095ebc3eb:/tmp/uSockets# ./http_server Failed to listen! root@5b4095ebc3eb:/tmp/uSockets# cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.17.0.2 5b4095ebc3eb root@5b4095ebc3eb:/tmp/uSockets# vim /etc/hosts # Remove `::1 localhost ip6-localhost ip6-loopback` root@5b4095ebc3eb:/tmp/uSockets# ./http_server # works now Listening on port 3000... ^C
The server fails to bind, but if you remove ::1 from /etc/hosts, it starts successfully. It binds 127.0.0.1 now.
::1
/etc/hosts
127.0.0.1
Regarding why there is still ::1 record present in the container even though IPv6 is not configured, please see https://github.com/moby/moby/issues/35954
From https://github.com/oven-sh/bun/issues/5315
Reproduce
examples/http_server.c
https://github.com/uNetworking/uSockets/blob/ac4e90e4d2ad674db903accc5f3abc408a6bc5d8/examples/http_server.c#L123
change to bind
localhost:3000
debian:sid-slim
image and then run thehttp_server
. (docker has not been configured for IPv6 stack)The server fails to bind, but if you remove
::1
from/etc/hosts
, it starts successfully. It binds127.0.0.1
now.Regarding why there is still
::1
record present in the container even though IPv6 is not configured, please see https://github.com/moby/moby/issues/35954