This is not necessarily the current version of this TIP.
| TIP: | 162 |
| Title: | IPv6 Sockets for Tcl |
| Version: | $Revision: 1.10 $ |
| Authors: |
Rafael Martínez Torres <rafael dot martinez at novagnet dot com> Donal K. Fellows <donal dot k dot fellows at manchester dot ac dot uk> Reinhard Max <max at tclers dot tk> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.6 |
| Vote: | Pending |
| Created: | Thursday, 23 October 2003 |
This TIP is about allowing Tcl to use IPv6 sockets in virtually the same way that you would use the current (IPv4) sockets.
IPv6 is the next generation of the IP protocol that underlies Internet sockets. IPv6 advantages include a wider address space (128 bits instead current 32 bits), improved mobility, mandatory security at IP layer (IPsec...), etc. Tcl should allow the programmers try both protocols at their networking programs without too much effort (dependant on underlying operating system support, of course), just accepting the literal address (2001:80:2aff::24, 192.23.56.3) or the DNS names (www.server.com).
The interpreter should understand:
socket 2001:800:4a01::2 echo socket 192.168.34.43 http socket -server accept 9999 socket www.euro6ix.org 42
Where a hostname resolves to multiple addresses in multiple families, the addresses are tried one by one as returned by the the resolver library until a connection can be established. The order depends on the resolver library and its configuration; it is deliberately not touched by Tcl, so that local preferences are automatically respected by Tcl programs.
The fconfigure command should give detailed info on resulting sockets, for example:
% set s [socket -server foo 0]
sock5
% foreach {k v} [fconfigure $s] {puts [list $k $v]}
-blocking 1
-buffering full
-buffersize 4096
-encoding iso8859-1
-eofchar {{} {}}
-translation {auto crlf}
-sockname {0.0.0.0 0.0.0.0 54142 :: :: 54142}
The -sockname and -peername options are the affected ones; for client sockets they can indicate addresses in the IPv6 or IPv4 namespaces, and for server sockets the -sockname option will list all the addresses bound (2 in the above example), three elements each. To maximize backward compatibility, the IPv4 address (if bound) will always be listed first. (Client sockets will always only list a single address as they will always be connected by a definite protocol.)
A patch is available for UNIX platforms [1].
A development branch has been opened up; see [2] for details.
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.