Fixed a non fatal endian issue when printing IP addresses on big endian systems
This commit is contained in:
parent
ee5d42f8bb
commit
51d96a9659
|
@ -49,7 +49,17 @@ public static class EasyServerExtensions
|
||||||
foreach(var item in iface.GetIPProperties().UnicastAddresses)
|
foreach(var item in iface.GetIPProperties().UnicastAddresses)
|
||||||
{
|
{
|
||||||
if(item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork){
|
if(item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork){
|
||||||
|
if(BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
ips.Add($"{url.scheme}://{item.Address.ToString()}:{url.port}/");
|
ips.Add($"{url.scheme}://{item.Address.ToString()}:{url.port}/");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var addrBytes = item.Address.GetAddressBytes();
|
||||||
|
ips.Add($"{url.scheme}://{addrBytes[3]}.{addrBytes[2]}.{addrBytes[1]}.{addrBytes[0]}:{url.port}/");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine(string.Join(" , ",ips));
|
Console.WriteLine(string.Join(" , ",ips));
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<PackageId>Tesses.WebServer.EasyServer</PackageId>
|
<PackageId>Tesses.WebServer.EasyServer</PackageId>
|
||||||
<Author>Mike Nolan</Author>
|
<Author>Mike Nolan</Author>
|
||||||
<Company>Tesses</Company>
|
<Company>Tesses</Company>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.1</Version>
|
||||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.1</AssemblyVersion>
|
||||||
<FileVersion>1.0.0</FileVersion>
|
<FileVersion>1.0.1</FileVersion>
|
||||||
<Description>An easier way to setup server for Tesses.WebServer</Description>
|
<Description>An easier way to setup server for Tesses.WebServer</Description>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageTags>HTTP, WebServer, Website</PackageTags>
|
<PackageTags>HTTP, WebServer, Website</PackageTags>
|
||||||
|
|
Loading…
Reference in New Issue