[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Programmers can't get IPv6 thus that is why they do not have IPv6 in their applications"....

On Nov 28, 2012, at 10:47 AM, Ingo Flaschberger <if at xip.at> wrote:

> Am 28.11.2012 19:30, schrieb david peahi:
>> Many years ago the standard books on application network programming were
>> based on C language. Books such as "Adventures in UNIX Network
>> Programming", and Professor Comer's "Internetworking with TCP/IP Vol 3"
>> detailed how to write C programs using BSD sockets where binding to a
>> socket brought the program up in listening mode on an 2 tuple IP v4 IP
>> address/TCP well known port. Once the program opened and bound to a socket
>> "netstat -n" would show that program to be "listening" on the 2-tuple.
>> Do today's programmers still use basic BSD socket programming? Is there an
>> equivalent set of called procedures for IPv6 network application
>> programming?
>> On the practical side: Have all programmers created a 128 bit field to
>> store the IPv6 address, where IPv4 programs use a 32 bit field to store the
>> IP address? This would seem to be similar to the year 2000 case where
>> almost all programs required auditing to see if they took into account
>> dates after 1999.
> on linux/unix: if the program only opens a tcp-connection or listen on it, it's simple.
> socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) -> socket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)

You left out some structure changes an the need to use getaddrinfo()/getnameinfo() in place of

Depending on your implementation, you might also need to make some changes to your bind() call and/or the way you iterate through the returns from getaddrinfo() calling connect().

> It's more work, to build a dual-stack program - then 2 sockets needs to be opened and handled.
> But overall - it's trivial.

Not if your system properly supports IPV6_V6ONLY=false default sock opt.

If you're stuck on something based on BSD or WinSock where this is broken, then, yes, you may have to open 2 sockets or at the very least make a deliberate setsockopt() call or specify the option in the socket() call.