UDP and TCP in Mesh

From recent posts I sort of get the impression that things previously implemented using TCP have been moved to UDP in the Mesh products - for example some of the link to the cloud (really… UDP over Internet … ??) .

Is TCP still available as a full protocol stack in the Mesh devices and can, for example, a TCP socket connection be opened and maintained between nodes or a gateway to node ? I realise the data rates are low.

I ask this ‘naively’ without having digested all the docs yet or read up on Thread. Is guaranteed ‘one to one’ delivery an option, and the issue is just the broadcast ‘one to many’ events which may need some extra ACK layer.

UDP

  • Argon
  • Boron
  • Xenon

TCP

  • Argon (TCPServer and TCPClient)
  • Boron (TCPClient)
  • Xenon + Ethernet Featherwing via the Ethernet Port (i.e. Xenon by itself cannot do TCP)

So there is no IP layer on Mesh… but I’m interested is there a guaranteed message delivery API between mesh nodes that we can use (guaranteed meaning it raises an error if it does fail).

And why is UDP being used between Argon and the Cloud IDE ?

So there is no IP layer on Mesh

Not true. Thread creates a IPv6 Mesh network.

And why is UDP being used between Argon and the Cloud IDE ?

I think you meant between Argon and the :particle: :cloud:. All Gen3 products connect to the :particle: :cloud: through UDP, similar to Electron. I don’t have the details why but this is how it is being implemented.

So can I leverage that to create a path to pass data between two nodes with similar features to TCP - guaranteed delivery, sequencing, error correction, retries, routing etc. ?

Between mesh nodes, or between a mesh-only node (Xenon) and a gateway you can only use UDP. There is no TCP support in Thread Mesh at this time.

The reason is that Thread Mesh is basically a store and forward network when delivering packets between repeaters and nodes, especially nodes that uses sleep modes, and it would have poor TCP performance so it was not initially included in Thread Mesh.

4 Likes

I am looking at migrating our Photon-based solution to Mesh. Currently, our Photons open a TCP connection and stream data to our endpoint server. From what I’m reading, does this fundamentally change with Mesh? Do I need to stream that data (from Xenon) via UDP to the gateway (Boron) then have the gateway pass that on via TCP?

Are there any examples of people streaming data (not just Publish) from Xenons through Argon/Boron to server endpoints (e.g. AWS)?

Thank you :slight_smile:

The mesh network is not directly connected to the Internet, so yes you need to convey data to the gateway over the mesh, which would then connect to a server on the Internet using TCP or UDP.

This isn’t necessary for Particle.publish, where the gateway automatically forwards the data.

I thought that the whole point of Thread being IP based , is to eliminate the need for the nodes functionality to be distributed between the node and the gateway. So mobile apps can directly talk to mesh node , and mesh nodes can talk directly to IP devices on the local wifi or the Internet .

The advantage of Thread over Z-Wave and Bigsbee

That is at least what I got from reading https://www.threadgroup.org/What-is-Thread

As it turns out, I was wrong. The gateway is more of a router than I thought. You still cannot connect to the outside world using TCP, but UDP works surprisingly well.

You can send UDP to an IPv4 host on your local LAN or the Internet, and get responses back to your Xenon transparently!

5 Likes