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

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

Situation

Suppose you are a socket programmer that works for an application development company that specializes in socket applications for iSeries™. To keep ahead of their competitors, you have 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™ supports the AF_INET6 address family sockets which provides interoperability with AF_INET address family sockets. You also know this can be accomplished 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 C Compiler licensed program (5722–CX2).
  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.

Scenario details

The following graphic describes the IPv6 network for which you create applications to handle requests from IPv6 and IPv4 clients. The iSeries contains the program that listens and processes requests from these clients. The network is comprised of two separate domains, one that contains IPv4 clients exclusively and the other remote network containing only IPv6 clients. The domain name of the iSeries 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() function call.


Network diagram shows a IPv6 network connected to a IPv4 network

Related reference
Use AF_INET6 address family