[plt-scheme] IPv6?
At Sat, 23 Jul 2005 10:35:20 +0200, Johan Liseborn wrote:
> Are there any plans on adding IPv6 support to PLT Scheme?
MzScheme in the SVN respository trunk supports IPv6.
I'm not certain about some of the design decision noted below --- I'm
especially concerned about "localhost" --- so I welcome feedback from
those with more experience on this topic.
Notes:
* By default, `tcp-listen' and `udp-open-socket' create sockets that
work with IPv4, only. For `tcp-connect', etc., the hostname
determines the protocol family.
* If you system supports IPv6, beware that "localhost" is probably
mapped to an IPv6 address by default. In that case, if you're trying
to contact an IPv4 server, it probably won't work; use "127.0.0.1"
instead.
* Depending on your system's capabilities, you might supply "::" as
the local hostname for `tcp-listen' to get a listener that accepts
both IPv4 and IPv6 connections. This works under Mac OS X and
Linux, for example, but under Windows it creates an IPv6-only
listener.
* The `udp-open-socket' function now accepts optional hostname and
port arguments. If they're supplied, then the new socket's protocol
family is the one implied by the address and port. For example,
`(udp-open-socket "::")' creates an IPv6 socket if the system
supports it. On some systems (e.g., Linux), the resulting IPv6
socket can also send and receive IPv4; on some systems (e.g., Mac OS
X), it can only receive IPv4; on some systems (e.g., Windows), it
doesn't support IPv4 at all.
Arguments to `udp-open-socket' merely determine the socket's
protocol family; `udp-open-socket' doesn't bind the socket. If the
socket is going to be used to communicate with a specific host, then
supplying the host to `udp-open-socket' is a good way to ensure that
the socket's protocol family is consistent with the target host.
Similarly, if the socket is going to be bound to a particular host
and port, supplying those values to `udp-open-socket' ensures that
the binding will work.
Matthew