chickadee » tcp6 » tcp-listen

tcp-listen TCPPORT #!optional BACKLOG HOSTprocedure

Creates and returns a TCP listener object that listens for connections on TCPPORT, which should be an exact integer. BACKLOG specifies the number of maximally pending connections (and defaults to 10).

If the optional argument HOST is given and not #f, then only incoming connections for the given host (or IP) are accepted.

When HOST is #f (the default), the behavior is system-dependent. It should listen on all IPv4 and IPv6 addresses if possible, or just on IPv4 if IPv6 is disabled. This is true on OS X and Windows. Unfortunately, certain systems may always prefer to listen on IPv4 only (particularly those using recent glibc, like Ubuntu).

Special note when HOST is #f. If you have set (tcp-bind-ipv6-only #t), or if tcp-bind-ipv6-only is not supported by your OS, we always listen on "" to IPv4 only. This is done because users will expect (tcp-listen port) to listen at least on IPv4. To listen to IPv6 only in this case, explicitly specify a HOST of "::".

Long story short, setting HOST to #f will more likely than not give you an IPv4-only listener.