I'm using Python to develop an OPC client with the freeopcua package. To test it, I'm using Prosys OPC Simulation Server. This program lets you host a server on your computer that simulates data to see if you can successfully read and write from your client.

However, I'm having trouble with which I believe is a networking issue. The connection address of the simulated server is opc.tcp://DESKTOP-EPETSMR:53530/OPCUA/SimulationServer. Thus, when I write these lines in the Python script, I can successfully connect to it:

client = Client("opc.tcp://DESKTOP-EPETSMR:53530/OPCUA/SimulationServer/")
client.connect()

The first line can be replaced with any of the following two, and it will work as well:

client = Client("opc.tcp://localhost:53530/OPCUA/SimulationServer/")

client = Client("opc.tcp://127.0.0.1:53530/OPCUA/SimulationServer/")

Now I want to access the server from another computer (i.e. a different computer from the one that is hosting the server) that is connected to the same WiFi network. I thought that replacing the loopback IP 127.0.0.1 with the IP of the computer would be enough. So I ran ipconfig from Windows' command prompt and got:

Wireless LAN adapter Wi-Fi:
    IPv4 Address. . . . . . . . . . . : 192.168.1.5
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . : 192.168.1.1

But when I run the previous two lines replacing the loopback IP address with 192.168.1.5, the client cannot connect to the server.

So I tried to perform a ping in both ways (from one PC to another) and both worked okay, so it appears that the issue is not the communication between both hosts.

Any idea of how could this be fixed?

  • What OS is this? And does the OS running the OPC server have any firewall running? – Tim_Stewart Jun 15 at 3:53
  • @Tim_Stewart The server is on Windows 10, the client is on Raspbian. Windows Firewall is activated. – Tendero Jun 15 at 13:11
  • I would suggest disabling it for troubleshooting. Use NMAP to scan the server on the local network, it will let you know if the server port is open and accepting connections. – Tim_Stewart Jun 15 at 13:12
  • @Tim_Stewart If I run nc -zv 192.168.1.5 53530 on the Raspi, connection is successful. Doesn't this mean that the port is open and accepting connections? – Tendero Jun 15 at 13:15
  • @Tim_Stewart Turning off the firewall worked. Do you know how to make this work without turning of the firewall completely? – Tendero Jun 15 at 13:23

Add the OPC server program to windows firewall exceptions:
Open the Control Panel.
select “System and Security“.

syssecurity

In the Windows Firewall section, select “Allow a program through Windows Firewall“. firewall

Unchecking the box to the left of the application name disables it from accessing network resources, while checking it allows access. win7
If the program you wish to block or unblock is not listed, you can click the “Allow another program…” button to add it.

Choose the application in the list and select “Add“.
If the program is not in this list, use the “Browse…” button to select the program file manually.

Regards,

  • Thanks for your answer. The program that simulates the OPC server is already checked in the list. How is it possible that the client can connect only when the firewall is off, even if the firewall is allowing the program to access network resources? – Tendero Jun 15 at 15:13
  • Hmm, my guess is that there is another exe interfacing with the network? – Tim_Stewart Jun 15 at 15:30
  • This may be relevant to you. techsupport.osisoft.com/Troubleshooting/KB/2973OSI8 – Tim_Stewart Jun 15 at 15:31
  • @tendero, You get this figured out? – Tim_Stewart 2 days ago
  • 1
    Now it just works, even with the firewall on. I was trying to figure out why it didn't work before, but now it just does... Weird things that happen with computers that I'll never understand! – Tendero 2 days ago

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.