morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

fix hog server listens only on localhost #450

Closed mo-xiaoming closed 1 year ago

mo-xiaoming commented 1 year ago
       If the AI_PASSIVE flag is specified in hints.ai_flags, and node
       is NULL, then the returned socket addresses will be suitable for
       bind(2)ing a socket that will accept(2) connections.  The
       returned socket address will contain the "wildcard address"
       (INADDR_ANY for IPv4 addresses, IN6ADDR_ANY_INIT for IPv6
       address).  The wildcard address is used by applications
       (typically servers) that intend to accept connections on any of
       the host's network addresses.  If node is not NULL, then the
       AI_PASSIVE flag is ignored.

       If the AI_PASSIVE flag is not set in hints.ai_flags, then the
       returned socket addresses will be suitable for use with
       connect(2), sendto(2), or sendmsg(2).  If node is NULL, then the
       network address will be set to the loopback interface address
       (INADDR_LOOPBACK for IPv4 addresses, IN6ADDR_LOOPBACK_INIT for
       IPv6 address); this is used by applications that intend to
       communicate with peers running on the same host.

https://man7.org/linux/man-pages/man3/getaddrinfo.3.html

without AI_PASSIVE, hog server always listens on localhost