When would it be beneficial to associate an address and port to a device as one of its owned endpoints?
Rarely at best, and probably never. You're assuming that's why a sockaddr
is used.
In fact, it's used as a way of supporting multiple address types; yes, a sockaddr
might contain a port number, if it's AF_INET
or AF_INET6
, but, as the "if it's" clause suggests, it also contains an address family value.
libpcap/WinPcap is a cross-platform library, originally created for BSD UN*X, and created long before .NET even existed, so it was obviously not designed with .NET's networking objects in mind. (pcap_findalldevs()
wasn't an API in the original libpcap, but it was added back in August-September 2001, which was before the final version of .NET 1.0 came out.)
The port number is not set to anything significant by pcap_findalldevs()
, so there's no need to expose it in your wrapper.