It’s been a few Zig versions since I last did any UDP networking, and back then I used the zig-network library to abstract away the platform-specific implementations.
But now, looking again at Zig 0.15 and possibly 0.16, I’m curious how much is natively available without the need for a library.
std.net looks nice, but it appears to be TCP only
Does UDP usage still require dropping to std.posix? What about on Windows?
Is std.Io bringing more net functionality in 0.16?
Also, it looks like the zio library is getting a lot of attention as an I/O alternative, and has network functionality built-in. Is this because support is still lacking in the standard library? Or is zio more like a difference of opinion on API design from Zig?
I’ve used Zig std.Io for making a small udp server for streaming h264, as a side project, don’t know if that helps : ustream Probably doesn’t compile with current master if I had to guess.
When I started, std was heavily lacking in networking. The networking capabilities it had were fine for the use case of the compiler, but any external project that was usable in production had their own networking layer.
I didn’t want to write another asynchronous networking layer for my application alone, so I invested time into zio. From the ground up it’s built with servers in mind.
You can already use zio with the std.Io APIs. As the interface matures, maybe it will become the only API. Even the native zio APIs are heavily based on std.Io to simplify the migration. Once 0.16 is released, the I’ll start shifting more into just an implementation of the interface.
But I believe the the architecture of zio is already better than the planned std.Io.Evented in terms of design for writing server applications, so the runtime will stay.