Hi all,

yesterday I tried to enable PicoLisp for IPv6. In the end I gave it up,
and decided to postpone the issue.

The problem is not IPv6 by itself, but the question how to support
_both_ protocols for the next years.

At first things looked good. Changing 'connect' was no problem. I used
getaddrinfo() as recommended to get the list of visible servers (any
protocol), and then iterated that list until an entry was found where
socket() and connect() succeeded. So this works transparently for IPv4
and IPv6 servers, local and remote.

Then 'udp' gave the first trouble. Again, getaddrinfo() returns a list
of IPv4 and IPv6 addresses. But I found no way to determine which is the
right one to use, as UDP gives no indication of success or failure.
Calling socket() and sendto() succeeds, no matter whether the remote
server supports IPv6 or not. Does anybody know what to do here?

Finally, I didn't find a solution for the server side. This is the
'port' function, which takes a port number (or a range of numbers), and
returns a socket descriptor (a number) bound to a port. This number can
be used in functions like 'listen', 'accept' or 'udp'.

Now it would be nice if there were a way to bind that socket in such a
way that it accepts both IPv4 and IPv6 connections. In fact, this is
even possible (using hybrid "mapped addresses"), but this is not
recommended, because it does not work on some operating systems (e.g.
OpenBSD), may impose security problems, and didn't work here on my Linux
box anyway (it is also a matter of configuration, bug I didn't dig into

The recommended way, using two sockets for each listening server is also
not an option. For one thing, I don't want to use the double number of
file descriptors. Second, it breaks the PicoLisp API where a socket is
returned from 'port', and passed to 'listen' or other functions. This
would break if more than one socket were involved.

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to