Community Blog Buy Now
Blog

Misty Community Forum

External networking besides HTTP requests?

Is it possible to use UDP, TCP, or WebSockets from a .NET skill? If so, are there any examples? If not, why not?

The answer is yes! I now have a .NET skill that creates a WebSocket client! Good times!

1 Like

:+1:

Did you use Windows.Networking.Sockets or another tool for this?

I’ll flag @morgan to keep me honest, but whenever I have a questions like “Can you do x with Misty’s .NET SDK?”, the answer is usually along the lines of, “If you can do it in a UWP app that runs on ARM, you can do it in a .NET skill.”

I am using System.Net.WebSockets, following the pattern in ros-sharp.

I am new to C#, but this is encouraging me to expect that we can create a ROS wrapper as a Misty skill.

1 Like

Yes, you should have full access to the networking stack, so you could use any (reasonably speaking) protocol you choose. If you’re looking for low overhead, you may want to look into using a raw socket and UDP. Websockets work reasonably well, but come with some HTTP overhead.

1 Like

Indeed. I just created a Misty .NET skill that communicates via UDP.

My motivation for also trying WebSocket is to leverage prior work, including ros-sharp (linked above) and the rosbridge_server that uses WebSockets for transport.

What are you referring to when you write “raw socket”?

If those projects already use websockets, there’s little reason to adopt something different. When I’m referring to a raw socket, I’m referring to System.Net.Sockets.Socket. If I have to invent the message protocol on both sides of a system, I generally prefer to use a raw socket as the performance is top-notch. If the transport or protocol are already defined or if those two constructs are tightly coupled, there’s little value in inventing something different.