Getting PubSub to work with the PubSub evaluation bundle

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
tijmenv
Full Member
Full Member
Posts: 5
Joined: 13 May 2015, 12:33

Getting PubSub to work with the PubSub evaluation bundle

Post by tijmenv »

Hello support team,

I am trying to get the pubsub communication up and running by using the server_cpp_demo binary from the PubSub 1.7.0 (449) evaluation bundle. My approach is to start two
of these binaries both on different server ports (48010 and 48011). Then use the pubsubimporter tool to load the same configuration to both services (the profile is udp-uadp with port 4840). This seems to work
since there are now various DataSets available in the PublishSubscribe section of the server object. I use DataSimple.
My expectation is that from this point the pubsub should be active and there should be communication between the two services. When I change the variable PSTV.P1.DS1.BoolToggle (Under Objects/PubSubTargetVariables) the change is not reflected to the other service. When I use wireshark to see if there is any communcation on the specified PubSub port (4840) I see no communication what so ever. I have tried multicast (239.0.0.1) as well as unicast (127.0.0.1).

In the server logs I do see the following:
11:28:01.241Z|3|657B1780* [pubsubstack] Using 0 KB for memory pools (shared).
11:28:01.241Z|3|657B1780* [pubsubstack] Using 0 KB for memory pools (private).
11:28:01.241Z|3|657B1780* [pubsubstack] pool configuration:
11:28:01.241Z|3|657B1780* [pubsubstack] heap...................................................16777304 bytes (shared)
11:28:01.241Z|3|657B1780* [pubsubstack] ipc memory area: 0x0x7f8256fff010 - 0x0x7f8257fff2b0
11:28:01.241Z|3|657B1780* [pubsubstack] pool addresses:
11:28:01.241Z|3|657B1780* [pubsubstack] heap............................0x7f8256fff258 - 0x7f8257fff257 (shared)
11:28:01.295Z|7|657B1780* [pubsubstack] ua_socket_init: Socket created
11:28:01.295Z|7|657B1780* [pubsubstack] ua_socket_initset: initializing socket 4 in slot 0 (sock: 0x2bddf30)
11:28:01.295Z|1|657B1780* [pubsubstack] ua_socket_bind: ERROR -1 (errno: 13) binding to port 20
11:28:01.295Z|7|657B1780* [pubsubstack] ua_socket_close: closing socket 4
11:28:01.295Z|7|657B1780* [pubsubstack] ua_socket_close: socket at slot 0 freed
11:28:01.305Z|7|657B1780* [pubsubstack] ua_socket_init: Socket created
11:28:01.305Z|7|657B1780* [pubsubstack] ua_socket_initset: initializing socket 4 in slot 0 (sock: 0x2bddf98)
11:28:01.316Z|1|648A1700* [pubsubstack] invalid shutdown flag: pubsub_do_com_eval called but flag is 2 [SHUTDOWN_COMPLETED] (forgot to call startup?)
I do not understand why it tries to bind to port 20??? I'm clearly missing something. Could you shed some light on these issues?
When running the services as root, the port 20 message disappears from the log because it can now use this privileged port. The end result is still same.

Kind regards, Tijmen

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

Re: Getting PubSub to work with the PubSub evaluation bundle

Post by Support Team »

Hi Tijmen,

There are two potential problems.

(1) Multiple network adapters
If you have multiple network adapters, you need to configure the network adapter to use by setting the IP-address as parameter in the network adapter setting

(2) Source port setting
As indicated in the forum post, a source port is used for bind that is already used.
In the version you have, the source port for the send side was not initialized. This is already fixed in version 1.7.1

The service release 1.7.1 is currently in final testing.
Best regards
Unified Automation Support Team

tijmenv
Full Member
Full Member
Posts: 5
Joined: 13 May 2015, 12:33

Re: Getting PubSub to work with the PubSub evaluation bundle

Post by tijmenv »

Hello support team,

I have tried to set the ip address so that the correct interface is chosen. I still get the same socket error at the end (socket in SHUTDOWN_COMPLETED) and there is no communication.

These are my network interfaces:
1: lo: <LOOPBACK,MULTICAST,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:c9:8a:07 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
valid_lft 61058sec preferred_lft 61058sec
inet6 fe80::a00:27ff:fec9:8a07/64 scope link noprefixroute
valid_lft forever preferred_lft forever
So i updated my PubSub configuration as follows:
[PubSubConnections]
...
UDP1/AddressUrl=opc.udp://239.0.0.1:4840
UDP1/AddressNetworkInterface=10.0.2.15
...
Alas, still no communication...

Kind regards, Tijmen

tijmenv
Full Member
Full Member
Posts: 5
Joined: 13 May 2015, 12:33

Re: Getting PubSub to work with the PubSub evaluation bundle

Post by tijmenv »

I tried again with the pubsub stack version 1.7.1. The demoserver is now able to publish and subscribe. Variables in the address space of PubSubTargetVariables/Publisher1/DataSet[123] get updated.

Aside: I noticed that the pubsubimporter example is missing in uasdkcppbundle-src-debian9.3-x86_64-gcc6.3.0-v1.7.1-476.tar.gz

Kind regards, Tijmen

vinothtcecse
Jr. Member
Jr. Member
Posts: 4
Joined: 17 Apr 2019, 15:41

Re: Getting PubSub to work with the PubSub evaluation bundle

Post by vinothtcecse »

Hi,

Demo server is able to publish and subscribe using UDP?
is MQTT support available?

Regards,
Vinoth
tijmenv wrote:I tried again with the pubsub stack version 1.7.1. The demoserver is now able to publish and subscribe. Variables in the address space of PubSubTargetVariables/Publisher1/DataSet[123] get updated.

Aside: I noticed that the pubsubimporter example is missing in uasdkcppbundle-src-debian9.3-x86_64-gcc6.3.0-v1.7.1-476.tar.gz

Kind regards, Tijmen

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

Re: Getting PubSub to work with the PubSub evaluation bundle

Post by Support Team »

Hello,

the PubSub with MQTT transport is not available.
Best regards
Unified Automation Support Team

Post Reply