Andrew Simpson Andrew Simpson - 9 months ago 68
C# Question

Is it possible to use UDP with Web Sockets instead of TCP

I have a C# desktop app and a C# Server console app.

The C# desktop client app uses WebSocket4Net and my C# server app uses Fleck.

Am I right in assuming that it uses TCP protocol. If so, can I get it to use UDP protocol?

The reason I asking this is because I read TCP is slower than UDP because TCP ensures order of packets.

I read this from this article:

Making Fast-Paced Multiplayer Networked Games is Hard

Answer Source

No, WebSockets are based on TCP which in turn is based on IP. UDP is also based on IP, but doesn't have anything to make sure the packets arrive in order or arrive at all. UDP just throws packets at a remote endpoint in the hope someone catches it. It's connectionless, so impossible to use UDP with WebSockets.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download