1

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?

5
  • What OS is this? And does the OS running the OPC server have any firewall running? Commented Jun 15, 2018 at 3:53
  • @Tim_Stewart The server is on Windows 10, the client is on Raspbian. Windows Firewall is activated.
    – Tendero
    Commented Jun 15, 2018 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. Commented Jun 15, 2018 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
    Commented Jun 15, 2018 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
    Commented Jun 15, 2018 at 13:23

1 Answer 1

0

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,

5
  • 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
    Commented Jun 15, 2018 at 15:13
  • Hmm, my guess is that there is another exe interfacing with the network? Commented Jun 15, 2018 at 15:30
  • This may be relevant to you. techsupport.osisoft.com/Troubleshooting/KB/2973OSI8 Commented Jun 15, 2018 at 15:31
  • @tendero, You get this figured out? Commented Jun 17, 2018 at 20:43
  • 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
    Commented Jun 17, 2018 at 20:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .