server with both IPv4 and IPv6

Questions regarding the use of the ANSI C SDK for Server or Client development or integration into customer products ...

Moderator: uasdkc

Post Reply
rkoppler
Jr. Member
Jr. Member
Posts: 1
Joined: 20 Jan 2015, 13:41

server with both IPv4 and IPv6

Post by rkoppler »

Hello,

I am running an OPC-UA server (based on the ANSI C server SDK) on a target, which has both IPv4 and IPv6 enabled.
As expected, at server start-up the getaddrinfo() called issued by the server SDK returns two addresses.

The SDK creates its listener socket based on just the first address (which appears to be the IPv6 address),
the second address (which appears to be the IPv4 address) is ignored.

For network infrastructure reasons, however, the server should be reachable via IPv4 *and* IPv6 (the infrastructure
just supports IPv4). It would also help, if one could configure the server to create the listener socket for either
IPv4 or IPv6. How can I do this?

Thanks,
Rainer

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: server with both IPv4 and IPv6

Post by Support Team »

Hello Rainer,

The problem seems to be your target device not supporting dual protocol mode: if you specify the hostname in the endpoint URL and your TCP/IP stack supports dual protocol mode the endpoint should be reachable via IPv4 and IPv6 even if only the IPv6 address was used for creating the listener socket.

You can explicitly select the protocol family to use by providing the IP address instead of the hostname in the endpoint URL. In this case, the server is only reachable via the used address family, as the socket is bound to the specified IP only.

If your TCP/IP stack does not support dual protocol mode, you would need to open two separate endpoints, using the IPv4 address for one and the IPv6 address for the other endpoint. This is not possible using version 1.3.3 of the SDK, you would need to upgrade to 1.4.x to open multiple endpoints.

Best regards
Support Team

Post Reply