Hazel-Networking icon indicating copy to clipboard operation
Hazel-Networking copied to clipboard

Does Hazel support TCP?

Open Lisk90 opened this issue 2 years ago • 1 comments

I see in the included .docx (Hazel Networking Protocol.docx in the root) that there is a TCP implementation: https://i.imgur.com/b8rYxsN.png

However, this isn't listed in the features list on the main repo page.

Wondering if TCP is supported? And if not, what should I be aware of when working with RUDP, as someone with a TCP background?

Lisk90 avatar Aug 31 '23 16:08 Lisk90

Hello! TCP is not supported. In the old days, the previous maintainer supported it, but I wanted to descope it to a "highest performance self", which TCP doesn't accomplish because TCP implements reliability features with different goals in mind.

When working with RUDP, the biggest things to keep in mind is:

  • You can pick between RUDP and plain UDP. With TCP all data is 100% reliable always. But sometimes you should prefer responsiveness over reliability. You can save bandwidth and improve responsiveness by sending frequent updates unreliably.
  • Hazel specifically does not support packet fragmentation, so you have to worry about the Maximum Transmission Unit size. MTU varies from 560 to 1500 bytes, but leans towards the latter value for modern internet. IMO 1200 is a good value. If you try to send more bytes than the MTU, you may get dropped packets which can lead to missing data (unreliable) or disconnects (reliable).

That's more or less it. RUDP seeks to recreate TCP features in a more flexible/optional manner. So you should feel at home with it's connection-based interface and when sending reliable messages.

willardf avatar Jan 26 '24 19:01 willardf