I am stuck at converting a byte array to IPv4 or IPv6. Dot for IPv4 and Dot or Colon formatted for IPv6 strings should be the end result.
Greatly appreciate if someone uses LINQ to do this, thanks!!!
Have a look at inet_ntop()
.
Another option could be to use getnameinfo()
, provided you appropriately fill out a struct sockaddr_storage
, which is guaranteed to be large enough to be used as any struct sockaddr
you can imagine.