37 lines
888 B
C#
37 lines
888 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Net.NetworkInformation
|
|
{
|
|
// Token: 0x020001D1 RID: 465
|
|
internal struct Win32_SOCKET_ADDRESS
|
|
{
|
|
// Token: 0x06000EE9 RID: 3817 RVA: 0x000297A4 File Offset: 0x000279A4
|
|
public IPAddress GetIPAddress()
|
|
{
|
|
Win32_SOCKADDR win32_SOCKADDR = (Win32_SOCKADDR)Marshal.PtrToStructure(this.Sockaddr, typeof(Win32_SOCKADDR));
|
|
byte[] array;
|
|
if (win32_SOCKADDR.AddressFamily == 23)
|
|
{
|
|
array = new byte[16];
|
|
Array.Copy(win32_SOCKADDR.AddressData, 6, array, 0, 16);
|
|
}
|
|
else
|
|
{
|
|
array = new byte[4];
|
|
Array.Copy(win32_SOCKADDR.AddressData, 2, array, 0, 4);
|
|
}
|
|
return new IPAddress(array);
|
|
}
|
|
|
|
// Token: 0x04000D9A RID: 3482
|
|
private const int AF_INET6 = 23;
|
|
|
|
// Token: 0x04000D9B RID: 3483
|
|
public IntPtr Sockaddr;
|
|
|
|
// Token: 0x04000D9C RID: 3484
|
|
public int SockaddrLength;
|
|
}
|
|
}
|