# Sockets

**URL:** <https://forum.inductiveautomation.com/t/sockets/9239>\
**Category:** Module Development\
**Created:** [October 28, 2014, 4:19am UTC](https://forum.inductiveautomation.com/t/sockets/9239 "2014-10-28T04:19:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 28, 2014, 4:19am UTC](https://forum.inductiveautomation.com/t/sockets/9239/1 "2014-10-28T04:19:14Z")

</div>

Hi,  
Are there any restrictions of using TCP/IP sockets in Ignition modules (Irrespective of Ignition version 7.6 or 7.7 or which ever web server) ? If yes then what are they?  
Best Regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 28, 2014, 1:08pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/2 "2014-10-28T13:08:40Z")

</div>

No restrictions.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 28, 2014, 1:36pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/3 "2014-10-28T13:36:39Z")

</div>

but i observed a socket client works fine on same host but not from another machine on the network! it gives some run time error! Is my observation correct or there must be some coding error?  
regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 28, 2014, 1:45pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/4 "2014-10-28T13:45:08Z")

</div>

Must be an issue with the code, we don’t restrict what your module does in any way.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 28, 2014, 1:49pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/5 "2014-10-28T13:49:45Z")

</div>

Dear Kevin,  
Thanks a lot for the reply. I will relook at the code and give exact code snippet and error messages that I got.  
Best regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 28, 2014, 2:04pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/6 "2014-10-28T14:04:23Z")

</div>

Perhaps there might have been a port number conflict. Are there any reserved ports in Ignition? I should avoid using them. I think i used 4444. It is reserved?  
regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 28, 2014, 5:40pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/7 "2014-10-28T17:40:25Z")

</div>

No Kevin! A client on network is unable to connect to server in my ignition module. Whereas a local client on the host server works fine! Any clues why its happening?  
regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![pdibenedetto](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pdibenedetto/32/6364_2.png) [@pdibenedetto](https://forum.inductiveautomation.com/u/pdibenedetto)\
**Post date:** [October 29, 2014, 2:04am UTC](https://forum.inductiveautomation.com/t/sockets/9239/8 "2014-10-29T02:04:18Z")

</div>

> [@Pramanj](#):
>
> A client on network is unable to connect to server in my ignition module. Whereas a local client on the host server works fine!

Then you should check the firewall. If the client running locally on server connect and client running in another machine not, maybe could be a firewall filtering or another network configuration issue.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 29, 2014, 7:29am UTC](https://forum.inductiveautomation.com/t/sockets/9239/9 "2014-10-29T07:29:49Z")

</div>

But a stand alone socket server outside Ignition is connecting to network client!  
regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 29, 2014, 10:07am UTC](https://forum.inductiveautomation.com/t/sockets/9239/10 "2014-10-29T10:07:45Z")

</div>

> [@Pramanj](#):
>
> Perhaps there might have been a port number conflict. Are there any reserved ports in Ignition? I should avoid using them. I think i used 4444. It is reserved?PRAMANJ

You can use netstat to see what ports are active and the PID (process ID) using it:

`Windows:
netstat -a -o | FIND "LISTENING" | MORE`

`Linux:
netstat -l -p | more`

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 29, 2014, 12:39pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/11 "2014-10-29T12:39:19Z")

</div>

as per the list displayed, there is no conflict of port number. However the list is quite big surprisingly! There are 43 processes and 14 unique PIDs and 5 different IP addresses! 127.0.0.1; 169.254.213.64; 192.168.1.3; 0.0.0.0; [::]. This is only LISTENTING filtered, without it list is even bigger! I am wondering why so many sockets!  
Regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 29, 2014, 3:38pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/12 "2014-10-29T15:38:16Z")

</div>

localhost (127.0.0.1), 0.0.0.0, and 169.x.x.x are all internal. Windows (and Linux) use TCP/UDP as a transport layer between applications and services. Found that out the hard way, when I managed to delete the loopback adapter off my linux machine! 😆

Your next step is to see if the port is available to use outside the server. 😉

nmap or netcat are good command-line tools. So is PortQuery.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 29, 2014, 5:12pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/13 "2014-10-29T17:12:18Z")

</div>

Thanks for the clue, that explains the IP addresses and presnce of other TCP sockets.  
Best Regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 17, 2015, 5:13pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/14 "2015-01-17T17:13:48Z")

</div>

Hi,

I would like to once again open this topic!

I am unable to connect to a TCP server socket created in my Ignition module from a TCP client running on a remote machine in the network. Whereas the same client code works if executed on the Ignition server (localhost). 👿

If I create a TCP socket outside the Ignition module in a standalone java program then the same TCP client works fine from a remote machine on the network as well as on the local server machine where the standalone java program (TCP server) is running!

This gives me a doubt if somehow the Ignition module is blocking direct TCP connection from a remote machine having TCP client socket!

Can someone clarify what could be going wrong!

BR  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 20, 2015, 3:39pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/15 "2015-01-20T15:39:24Z")

</div>

There’s absolutely nothing in Ignition restricting your ability to open up sockets.

When you try to open one in you module do you get an error message? What’s the error message when the client on the other end tries to connect?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 20, 2015, 5:49pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/16 "2015-01-20T17:49:46Z")

</div>

The client on other machine cannot connect (times out with an exception) to the TCP server socket in side my Ignition module. Where as if I have the Server socket in a standalone application, it works fine. I would prefer the client directly to the TCP server in my ignition module.

BR  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 26, 2015, 5:30pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/17 "2015-02-26T17:30:52Z")

</div>

The connection request from TCP/IP client to Socket server is timing out, as if the host name is not recognized by server in the request to connect to socket server! Where as if the client application is on the same physical machine as the Server then request works fine! Does ignition do something to hide the server name? I tried giving IP address as well but that also doesn't worked.  
Any clarification will help.

Regards  
PRAMANJ

---

<div class="post-metadata">

**Author:** ![Elias\_Wagman](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@Elias\_Wagman](https://forum.inductiveautomation.com/u/Elias_Wagman)\
**Post date:** [October 17, 2023, 8:42pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/18 "2023-10-17T20:42:39Z")

</div>

Did you ever get anywhere with this? I am having the same exact problem.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 17, 2023, 8:45pm UTC](https://forum.inductiveautomation.com/t/sockets/9239/19 "2023-10-17T20:45:04Z")

</div>

Nine years later?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 18, 2023, 3:17am UTC](https://forum.inductiveautomation.com/t/sockets/9239/20 "2023-10-18T03:17:36Z")

</div>

Yes it was resolved long back! If I remember correctly there was an error in my code where a python socket server was getting opened in the script locally rather than a java socket imported from [java.net](http://java.net) library. Hence the socket server was accessible from local machine but not from other machine on the network!

Kevin was right in his reply in the above trail.
