Search code examples
linuxsocketsnetwork-programmingipv6ipv4

which dual stack server approach is better?


I wrote two server programs for a Dual stack before implementing in a application.

  1. Dual stack server program which can accept both IPv6 and IPv4 clients with a single IPv6 interface. But IPv4 reuest as a mapped IPv6 address.

  2. Dual stack server program having two interfaces are listening so as to handle IPv6 and IPv4 clients seperately like IPv6 interface for IPv6 clients and IPv4 interface for IPv4 clients, in which there is no involvement of IPv4 mapped address for IPv4 client request to server.

Both are working fine. But as i need to use only one server model to built my server application. so, which one is preferable or even suggest me if there is any other better model.?

Is IPv4 mapped IPv6 address will creates any problems in future.?

Can anyone please help me. Thanks in advance for the help. (working in Linux 2.6.9 environment & network programming using C.)


Solution

  • If you can do everything you need with IPv6 then I think that option 1 is much easier. Your code will be cleaner and maintenance will be easier. You might want to explicitly set the IPV6_V6ONLY flag to 0 in your code if you rely on this in case the default behaviour is changed by the sysadmin.