So for those that only skimmed, the problem here is bridging the gap between native Windows and Cygwin's POSIX emulation (which is a "terrible impedance mismatch"). This is made more difficult because Cygwin's Unix socket emulation is a "kind of awful"[0] undocumented protocol.
[0]: https://stackoverflow.com/questions/23086038/what-mechanism-...