I am trying to connect robot controler CODESYS program with OPC Expert through OPC UA server and that's listening 4840 port and on OPC Expert I'm getting like opc.tcp://hp-nb:4840/uadiscovery. I also installed freeopcua in my machine and that's listening 4840 port as well and on OPC Expert it's like opc.tcp//0.0.0.0:4840. On OPC Expert I need to connect with CODESYS application. I can connect with CODESYS OPC server but I'm not able to connect my application from CODESYS controler. Is it happening because of two servers are listening on same port? if not then how can I resolve my issue? Attached an image of my issue enter image description here
2 Answers
Two programs or processes running on the same computer cannot listen on the same port.
It would be possible only if that computer had two network interface cards with two different IPs and you could choose through which interface each process connect, a thing that is not usually possible to do
UPDATE
CODESYS Soft PLC emulator, which is usually installed with CODESYS, also includes an OPC Server listening on port 4840, if you stop the Soft PLC right clicking the icon on the windows notification area probably it will close the listening port

- 3,976
- 2
- 13
- 23
-
Thanks but I need to connect CODESYS OPC server for CODESYS data encryption. I removed the other freeOpc server from my machine but still it's showing 2servers are cnnected to port 4840 like before. I checked in resource monitor of my machine But there I found only CODESYS is listening to port 4840 in network activity, TCP connections and Listening ports. Thn how can I stop freeOPC server listening to port 4840? – SHAKIR SHOWMIK Nov 05 '20 at 12:31
In theory, two OPC UA servers could share the same port (on the same network interface) if they coordinate together. For opc.tcp, there is no standard way for them to do it. Therefore, two servers from the same vendor that are written in such special way could theoretically share the port. In reality, however, OPC UA servers using "opc.tcp" cannot share the same port, because they do not know how to coordinate the access and route the data.
For other protocols the situation is different. E.g. for OPC UA over HTTPS it is easier to have servers listening on the same port - mainly because the operating system already contains a piece that can listen on the port "for them", and route the requests based on the URL.
In your situation, however, it is not just that two server cannot share the same port. There is also a problem with the fact that one of the servers returns "0.0.0.0" as its IP address in the connection point description, which is invalid anyhow.

- 1,532
- 10
- 16
-
Regardiing 2servers I have removed freeOpcUa server from my machine. but still it's showing to listen on same port of 4840 on OPC Expert. Like if I check in my Resource monitor of my machine I can see that only CODESYS program is running on port 4840 on network activity, TCP connection and Listening ports. But then if I check OPC Expert I get freeOpc Server there on port 4840. And due to this issue I can't connect my target application through OPC server in OPC Expert or Ua Expert. So having this issue how can I stop listening freeOpc server on port 4840? – SHAKIR SHOWMIK Nov 05 '20 at 11:13
-
What do you mean by "if I check OPC Expert I get freeOpc Server there on port 4840". Isn't that just in a history of endpoints you tried before? Please describe the steps used in UA expert and at which point you see the server there. – ZbynekZ Nov 05 '20 at 16:44