UDPS

A small and efficient UDP library as a simple DLL.

Visit Website
February 4, 2023 UDP is a beautiful protocol.

I love simplicity.

Over the years, whenever I needed to communicate over network I used TCP, because that's the default choice - after all, you usually want your data to be delivered reliably.

But I was never happy with it.

TCP creates a smoke-and-mirrors illusion of a virtual "pipe" laid between two computers, but due to the law of leaky abstractions, this illusion always breaks.

Most importantly - who really needs a "pipe"? We work with discrete things, like files or messages, so the very first thing a programmer does is to create yet another higher-level protocol on top of TCP to divide the continuous pipe back into discrete chunks! That's just stupid. Why not use a message-based protocol right from the start?

Ah, right, unreliability and the limited size of the datagram. Bummer. Back to TCP?

But what if we could make something in between? Something a bit more complicated than UDP, but simpler than TCP and message-oriented? A low-overhead protocol that would solve unreliability and limited datagram size.

So that what I decided to do. Create a lean, as simple as possible, protocol on top of UDP to add reliability and increase message size.

The UDPS project was born.

The library is based on Windows' I/O Completion Ports, which is the most efficient way to deal with the network stack. All memory is allocated via custom allocators based on virtual memory - it's extremely fast with next to zero overhead.

The network protocol is also efficient and has low overhead - it adds just 6 bytes to each datagram, and it makes transfers reliable and increases max packet size to 1 Mb!

I included a simple file transfer command-line tool into the package, with full source code, as an example of how to use the library and how easy it is.

This tool often provides much more streamlined workflow compared to something like FTP.

Overall, I am quite happy with how this project has shaped.

Comment

About

I couldn't find a simple, zero-bloat UDP library with a very lean protocol, so I made it myself :)