public unsafe override IPEndPoint[] GetActiveUdpListeners() { List <IPEndPoint> list = new List <IPEndPoint>(); int num = 0; Win32IPGlobalProperties.GetUdpTable(null, ref num, true); byte[] array = new byte[num]; Win32IPGlobalProperties.GetUdpTable(array, ref num, true); int num2 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_UDPROW)); fixed(byte *ptr = ref (array != null && array.Length != 0)?ref array[0] : ref *null) { int num3 = Marshal.ReadInt32((IntPtr)((void *)ptr)); for (int i = 0; i < num3; i++) { Win32IPGlobalProperties.Win32_MIB_UDPROW win32_MIB_UDPROW = new Win32IPGlobalProperties.Win32_MIB_UDPROW(); Marshal.PtrToStructure((IntPtr)((void *)(ptr + i * num2 + 4)), win32_MIB_UDPROW); list.Add(win32_MIB_UDPROW.LocalEndPoint); } } if (Environment.OSVersion.Version.Major >= 6) { int num4 = 0; Win32IPGlobalProperties.GetUdp6Table(null, ref num4, true); byte[] array2 = new byte[num4]; Win32IPGlobalProperties.GetUdp6Table(array2, ref num4, true); int num5 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_UDP6ROW)); fixed(byte *ptr2 = ref (array2 != null && array2.Length != 0)?ref array2[0] : ref *null) { int num6 = Marshal.ReadInt32((IntPtr)((void *)ptr2)); for (int j = 0; j < num6; j++) { Win32IPGlobalProperties.Win32_MIB_UDP6ROW win32_MIB_UDP6ROW = new Win32IPGlobalProperties.Win32_MIB_UDP6ROW(); Marshal.PtrToStructure((IntPtr)((void *)(ptr2 + j * num5 + 4)), win32_MIB_UDP6ROW); list.Add(win32_MIB_UDP6ROW.LocalEndPoint); } } } return(list.ToArray()); }