# Connection Issues with multiple programming programs

**URL:** https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038
**Category:** Support
**Created:** [May 11, 2025, 7:59am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038 "2025-05-11T07:59:40Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 11, 2025, 7:59am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/1 "2025-05-11T07:59:40Z")

</div>

Hey Factory IO team,

Im having multiple problems with both Siemens Tia V20 and Codesys with connecting to your Program.

In Codesys I get a error message right when I want to Configurate the OPC Client:  
I get the message: The secure channel has been closed: Remote side closed connection.

With Tia V20 and PLCSIM V20 I cant download your template to the device and get an error here. I tried it with my own programs for PLCSIM and dont have any problems.

What can I do to fix both issues? I would like to use your program as an simulation tool but its sadly not useable right now.

Regards  
Hendrik

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 12, 2025, 7:55am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/2 "2025-05-12T07:55:33Z")

</div>

Hello @h.steinbach.1,

Welcome to the forum!

The error when connecting to Codesys indicates that an OPC server can’t be found at that URL. To fix it, do the following:

1 - If Codesys Control Win is running, please close it.  
2 - Start Codesys Control Win V3 on a terminal:

 ![9be5cfbe02be3fab40161ea8c74e8db6.png](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/58b80811172ab06ab90fad0e592a559c19cdc3aa.png)

1. Find the server URL displayed in the terminal window

 ![1fe468c6e0e1f7578eb57a0c54447c05.png](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/7ce35d12c5eb6deebd0379b6b8db4f448958eb20.png)

1. In Factory I/O, Go to FILE \> DRIVERS \> CONFIGURATION and enter the URL in the OPC Server input field and press Enter to connect:

 ![ffe8eb7447a95e17f0dd3aad91275f34.png](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/875f75b54d2051adcf04c9f8f49ddb55570d1652.png)

1. Save the scene to keep your changes.

Regarding TIAPortal and S7-PLCSIM:

What error are you getting when downloading the template to PLCSIM?  
We have run some tests with TIAPortal V20 and PLCSIM V20, and we were able to download the template to PLCSIM without any issues. We did note that Factory I/O will connect to PLCSIM if you use S7-1200, but currently, it can’t connect to S7-1500. We are looking into this issue and will update you once we have more information.

I’ve also tested TIAPortal V20 with PLCSIM V19, and it worked perfectly, so this could be an alternative. With PLCSIM V19, you can use either S7-1200 or S7-1500.

I hope this helps.

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 12, 2025, 11:14am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/3 "2025-05-12T11:14:21Z")

</div>

Thank you for your reply, I tried it your way in Codesys but the error message is the same as before.  
The secure channel has been closed: Remote side closed connection

In TIA V20 I get following error

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/889de5c7768c6f4081ab667ba82f28b09fd46075.png)

I can only put one media per post but I hope this helps

Thank you for your help

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 13, 2025, 9:17am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/4 "2025-05-13T09:17:47Z")

</div>

The error you are getting in TIAPortal indicates it’s a problem with the CPU you are emulating. I went back to test this; the cause is the CPU version. You have to update it. To do so, in the Project Tree on the left side of the screen, select **Device Configuration**. Right click on the PLC and select **Change device**

 ![Screenshot 2025-05-13 095725](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/337df8350badaa579982454a48f035a14d1a6eb6.png)

Choose the CPU you want to use and select the most recent version.

 ![Screenshot 2025-05-13 095744](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/477bef06e295738b5cbf96aa2299bf710fa4d6b1.png)

Once you click OK, a window will appear to configure the PLC security settings.  
Set up a password and note it down as you’ll probably need it when you try to download to the PLC or SoftPLC. Make sure to disable access control in the **PLC access protection** section, so that Anonymous login is allowed.

Now you should be able to download to PLCSIM.

I hope this helps.

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 14, 2025, 12:06am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/5 "2025-05-14T00:06:24Z")

</div>

Thank you, that fixes the problem with PLCSIM.

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 14, 2025, 7:41am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/6 "2025-05-14T07:41:09Z")

</div>

I’m glad to hear you got it working!

Regarding Codesys, I apologize. I hadn’t noticed the issue with Codesys persists. What port are you using? Is it 4840?  
The error could also indicate that a firewall or antivirus is blocking Factory I/O or CodeSys softPLC.

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 14, 2025, 10:28am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/7 "2025-05-14T10:28:42Z")

</div>

The Port is 4840 yes.  
I tried deactivating my antivirus but no luck. can I bypass it in a way?

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 15, 2025, 7:41am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/8 "2025-05-15T07:41:43Z")

</div>

That’s most likely the issue. The OPC UA standard specifies port 4840 as a reserved port for the local discovery server (LDS). This is an OPC UA service used to browse for OPC UA servers running on a particular computer. It’s the responsibility of an OPC UA server to register itself correctly in the LDS.  
If an OPC UA server is registered in the LDS, clients will be able to discover the server’s URL (browse button on Factory I/O). However, an LDS is not required to connect to an OPC UA server if you know the server’s URL.

The problem is that, by default, Codesys uses the OPC UA server on port 4840, just like in your case. You have two possible solutions to fix this issue:

1. Uninstall the LDS
2. Change Codesys OPC UA port number

=== How to change Codesys OPC UA port number ===

OPC UA ports can be changed by editing the CODESYSControl.cfg file, which is typically located here C:\ProgramData\CODESYS\CODESYSControlWinV3x64\C515D9C. It may vary depending on your system and Codesys version.

1. Open this file by using a text editor.
2. Uncomment the following line and choose the desired port number (4841 should work fine)

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/ca53d7b8ba2350c89acbe7ee21271f28dc5b0f7a.png)

=== How to uninstall the LDS ===

1. Open the operating system’s Services Manager under “Start \> Control Panel \> System and Security \> Administrative Tools \> Services.”
2. Select the “OPC UA Local Discovery Server” service.
3. Right-click to open the menu and select STOP.
4. Confirm the setting with “OK”

I hope this helps.

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 16, 2025, 12:04pm UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/9 "2025-05-16T12:04:32Z")

</div>

As a tip for anybody having the same problem, the file is in your APPDATA folder. just type %APPDATA% in your search bar and you get there.  
The LDS service is under Windows tools-\> view local services

I changed the port number to 4841 like you sugestet and now have a new error code comming up in Factory IO  
I also changed the port to 4851 just to see if it does something but with the same result

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/63688020bd005315d90f0bcafff21ea6fe268479.png)

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 19, 2025, 8:20am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/10 "2025-05-19T08:20:13Z")

</div>

Hello @h.steinbach.1,

The error you are now getting indicates that the wrong port is being used.  
Did you save the file after editing it?  
Did you restart Codesys Control Win?  
Did you input the port in Factory I/O?

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [May 21, 2025, 11:22am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/11 "2025-05-21T11:22:17Z")

</div>

Thank you so much for your pacient helping me. I got it now to the point that Im connected to the port.  
Now I have the issue that the Function Block is not visible in the program.

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/factoryio/original/1X/382e9851c95ebffbfa4f57b78cd1760d1f51cde9.jpeg)  
can that be a problem with codesys to the opc server ? Or have I forgotten a setting?

---

<div class="post-metadata">

### Author: ![adriana.silva](https://dub1.discourse-cdn.com/flex017/user_avatar/community.factoryio.com/adriana.silva/32/752_2.png) [@adriana.silva](https://community.factoryio.com/u/adriana.silva)
#### Post date: [May 23, 2025, 8:18am UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/12 "2025-05-23T08:18:25Z")

</div>

Are you using a filter in Factory I/O? The filter might return no tags, and in that case, there is nothing to show on the driver’s page.  
Did you click “Browse” under Items/Nodes in the driver’s configuration page?

You can also check our Codesys OPC UA tutorial, in case you haven’t. Maybe there is a step there that you missed. You can find it here: [Setting up CODESYS OPC UA (SP17 or higher) - FACTORY I/O](https://docs.factoryio.com/tutorials/codesys/setting-up/codesys-opc-ua-sp17/).

---

<div class="post-metadata">

### Author: ![h.steinbach.1](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@h.steinbach.1](https://community.factoryio.com/u/h.steinbach.1)
#### Post date: [July 6, 2025, 12:17pm UTC](https://community.factoryio.com/t/connection-issues-with-multiple-programming-programs/4038/13 "2025-07-06T12:17:30Z")

</div>

Sadly my free duration was over already and I decided to not use the program going forward.  
Thank you for your Help  
Hendrik
