TCPServer on Electron

Hi!, is the TCPserver functionality currently impleented on Electron’s firmware? if not, which alternatives are available? thanks.

TCPServer cannot be used with the Particle SIM because the mobile carrier network does not allow inbound TCP connections. It probably won’t work with most 3rd-party SIM cards for the same reason.

It theoretically could work with a VPN-based SIM card, however in practice it does not appear to work, either.

You’ll need to use outbound connections (either TCP or UDP) to a server on the Internet, instead.

Here’s a lot of technical information on why various inbound techniques don’t work, at least with the Particle SIM card, because of security restrictions on the mobile carrier network:

1 Like

Thanks a lot @rickkas7. in our particular case, we need to use the electron as a TCPserver in order to transfer a bunch of samples to a TCPclient implemented on a Node.js server (so the data flow is always from Electron to Node.js) … so as i understand from your answer, that is not possible with TCP …but it is still not possible with UDP? thanks again for your support.
best regards

TCP is bi-directional, the client-server only determines which side starts the connection.

Typically the node.js side runs the TCP server. That makes sense because the server side must have a known and accessible IP address. The Electron’s IP address, in addition to not being known, is not accessible.

The TCPClient on the Electron makes a connection to the node.js server, and can either send data to node.js, or receive data from it. Both work.

This is an example of a node.js TCP server with a Photon sending data to it, but it works the same with the Electron (when the server has a publicly accessible IP address).


Yeah @fbt, it sounds like you should just be using webhooks to communicate with your node server. Running a full-blown TCP server on an electron seems like overkill.

Hi @Brewskey … the problem is that the data i have to send is more than a webhook supports … i’ll try to implemente the TCP client on the Electron, as @rickkas7 proposed. thanks!!!

Let us know if this works for you!