[ipv6 forum logo]
[Background image]
IPv6 Enabled Program
------New Service
IPv6 Enabled Logo IPv6 Enabled Logo IPv6 Enabled Logo
Home
IPv6 Enabled List
WWW
Introduction
Phase-1 Validated List
Phase-2 Validated List
Phase-1 Apply
Phase-2 Apply
Login
Report
APP
Introduction
Apply
Validated List
Documents
CDN
Apply
Validated List
Documents
ISP
Steering Group
Contact
News

Sample Code

Sample Code for Dual Stack Applications Using Non-Blocking Sockets

This sample code shows a way to use non-blocking sockets to allow a client to connect to IPv4 and IPv6 addresses in parallel, rather than serially. It is written in ANSI C, for use on FreeBSD or Ubuntu Linux.

There are two samples. The first is a client that makes a connection to a dual stack email server using the parallel connect routine. The second is a simple dual stack server that creates IPv4 and IPv6 listen sockets and accepts connections over either. It implements a simple telnet autoresponder. Both samples use a simple text-line oriented IO library that implements both a serial connect and a parallel connect.

Current clients connect to dual stack servers serially, which can lead in some cases to mysterious long timeouts before failing back to IPv4. Some content providers are unwilling to publish both A and AAAA records for their main URL because of this problem. Using parallel connection can eliminate these annoying timeouts, and hopefully allow content providers to publish both A and AAAA records, rather than provide a second, IPv6-only URL.

Powered By © IPv6 Forum 2009