Socket scenario: Creating an application to accept IPv4 and IPv6 clients

This example shows a typical situation in which you might want to use the AF_INET6 address family.

Situation

Suppose that you are a socket programmer who works for an application development company that specializes in socket applications for the i5/OS. operating system. To keep ahead of its competitors, your company has decided to develop a suite of applications that use the AF_INET6 address family, which accept connections from IPv4 and IPv6. You want to create an application that processes requests from both IPv4 and IPv6 nodes. You know that the i5/OS operating system supports the AF_INET6 address family sockets, which provides interoperability with AF_INET address family sockets. You also know that you can accomplish this by using an IPv4-mapped IPv6 address format.

Scenario objectives

This scenario has the following objectives and goals:

  1. Create a server application that accepts and processes requests from IPv6 and IPv4 clients
  2. Create a client application that requests data from an IPv4 or IPv6 server application

Prerequisite steps

Before developing your application that meets these objectives, complete the following tasks:

  1. Install QSYSINC library. This library provides necessary header files that are needed when compiling socket applications.
  2. Install the ILE C licensed program (5761-WDS option 51).
  3. Install and configure an Ethernet card. For information about Ethernet options, see the Ethernet topic in the information center.
  4. Set up TCP/IP and IPv6 network. Refer to the information about configuring TCP/IP and configuring IPv6.

Scenario details

The following graphic describes the IPv6 network, for which you create applications to handle requests from IPv6 and IPv4 clients. The i5/OS operating system contains the program that listens and processes requests from these clients. The network consists of two separate domains, one that contains IPv4 clients exclusively and the other remote network that contains only IPv6 clients. The domain name of the system is myserver.myco.com. The server application uses the AF_INET6 address family to process these incoming requests with the in6addr_any specified on the bind() API call.

Network diagram shows a IPv6 network connected to a IPv4 network