Hacker News new | ask | show | jobs
by pedasmith 2365 days ago
For a similar take on the problems, but with some different solutions, take a look at the UWP [StreamSocket](https://docs.microsoft.com/en-us/uwp/api/windows.networking....) (etc) classes.

Specifically, StreamSocket will happily go through proxies for you, will handle TLS / SSL (either at start up or after the connection is established), does IPv4 and IPv6 transparently. We also do service discovery using DNS-SD, although that's technically in a different class, as is the other network information. The SteamSocket class is designed to be very similar to the other socket-style classes like StreamWebSocket, so your code will (mostly) move from one to the other.

I've found from my own experience that the real key to a smooth network experience is the magic technology called "caring". It's easy to test if your code handles network disconnects; just run your code and yank the ethernet cable (or switch off Wi-Fi).

Source: am PM for the Network Developer Experience team at Microsoft and helped design the socket APIs.

2 comments

Is the DNS-SD API in windns.h under your purview? I have some gripes with it but don't know how to provide feedback.
No, but I know the team and will happily forward the feedback to them.
I write a lot of .NET, can confirm this is a great class

edit: any plans to add this (less Bluetooth support) to .NET standard?