Can/Should Helios be used to create a UDP server ?
ashutoshraina opened this issue · comments
First, should Helios be used to do the above (I think so)? My intention is to understand if I have the right tool for my job before I begin exploring this.I do understand that the documentation will come soon esp. around Reactors.
Hi Ashuto,
Yes it can! We have a working sample of a Udp socket server inside the "UdpReactorServer" sample project: https://github.com/Aaronontheweb/helios/tree/master/samples/Helios.Samples.UdpReactorServer
Every Helios socket server (reactor) or client (connection) consists of the following parts:
- A dedicated thread-pool for processing inbound and outbound requests, using C# socket best practices;
- A
MessageEncoder
andMessageDecoder
for encoding and decoding messages on the network - by default we use aFrameLengthEncoder
andFrameLengthDecoder
, which appends a 4-byte header to beginning of the message describing how many contiguous bytes are included in this message. - Event hooks for important network events such as received data, connections (yes,even for UDP - we track when data has been received from a new IP:PORT and fire the OnConnect event then), and network errors.
If you want to try out the UDP Reactor included in that example, I recommend also running our UdpRawSocket
example in parallel which uses the same encoding / decoding that the server does: https://github.com/Aaronontheweb/helios/tree/master/samples/Helios.RawUdpSocket
Just finished getting the samples to work together 👍
👍
Feel free to post any more questions here!