IPAddress.MapToIPv6 for.NET 4? [duplicate]

2019-09-05 18:08发布

问题:

This question already has an answer here:

  • Convert IPv4 to IPv6 manually 1 answer

I want to convert my IPv4Address into IPv6Address and IPAddress.MapToIPv6 is only for .NET 4.5

Any solution for .NET 4 ?

回答1:

An IPv4 address is translated to an IPv6 address by placing the 4 octets of the IPv4 address into the rightmost 4 octets of the IPv6 address.

Full method here

Ex: 192.168.25.234 -> C0A8:19EA



标签: c# sockets ip