2 // System.Net.NetworkInformation.IPGlobalProperties
5 // Gonzalo Paniagua Javier (gonzalo@novell.com)
6 // Atsushi Enomoto (atsushi@ximian.com)
7 // Marek Safar (marek.safar@gmail.com)
9 // Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections.Generic;
32 using System.Collections.Specialized;
33 using System.Globalization;
35 using System.Net.Sockets;
36 using System.Runtime.InteropServices;
39 namespace System.Net.NetworkInformation {
40 public abstract class IPGlobalProperties {
41 protected IPGlobalProperties ()
45 public static IPGlobalProperties GetIPGlobalProperties ()
48 return new AndroidIPGlobalProperties ();
50 switch (Environment.OSVersion.Platform) {
52 MibIPGlobalProperties impl = null;
53 if (Directory.Exists (MibIPGlobalProperties.ProcDir)) {
54 impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir);
55 if (File.Exists (impl.StatisticsFile))
58 if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) {
59 impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir);
60 if (File.Exists (impl.StatisticsFile))
63 return new UnixIPGlobalProperties ();
65 return new Win32IPGlobalProperties ();
70 internal static IPGlobalProperties InternalGetIPGlobalProperties()
72 return GetIPGlobalProperties ();
75 public abstract TcpConnectionInformation [] GetActiveTcpConnections ();
76 public abstract IPEndPoint [] GetActiveTcpListeners ();
77 public abstract IPEndPoint [] GetActiveUdpListeners ();
78 public abstract IcmpV4Statistics GetIcmpV4Statistics ();
79 public abstract IcmpV6Statistics GetIcmpV6Statistics ();
80 public abstract IPGlobalStatistics GetIPv4GlobalStatistics ();
81 public abstract IPGlobalStatistics GetIPv6GlobalStatistics ();
82 public abstract TcpStatistics GetTcpIPv4Statistics ();
83 public abstract TcpStatistics GetTcpIPv6Statistics ();
84 public abstract UdpStatistics GetUdpIPv4Statistics ();
85 public abstract UdpStatistics GetUdpIPv6Statistics ();
87 public abstract string DhcpScopeName { get; }
88 public abstract string DomainName { get; }
89 public abstract string HostName { get; }
90 public abstract bool IsWinsProxy { get; }
91 public abstract NetBiosNodeType NodeType { get; }
94 abstract class CommonUnixIPGlobalProperties : IPGlobalProperties
97 static extern int gethostname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len);
100 static extern int getdomainname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len);
102 public override string DhcpScopeName {
103 get { return String.Empty; }
106 public override string DomainName {
108 byte [] bytes = new byte [256];
109 if (getdomainname (bytes, 256) != 0)
110 throw new NetworkInformationException ();
111 int len = Array.IndexOf<byte> (bytes, 0);
112 return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len);
116 public override string HostName {
118 byte [] bytes = new byte [256];
119 if (gethostname (bytes, 256) != 0)
120 throw new NetworkInformationException ();
121 int len = Array.IndexOf<byte> (bytes, 0);
122 return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len);
126 public override bool IsWinsProxy {
127 get { return false; } // no WINS
130 public override NetBiosNodeType NodeType {
131 get { return NetBiosNodeType.Unknown; } // no NetBios
135 class UnixIPGlobalProperties : CommonUnixIPGlobalProperties
137 public override TcpConnectionInformation [] GetActiveTcpConnections ()
139 throw new NotImplementedException ();
142 public override IPEndPoint [] GetActiveTcpListeners ()
144 throw new NotImplementedException ();
147 public override IPEndPoint [] GetActiveUdpListeners ()
149 throw new NotImplementedException ();
152 public override IcmpV4Statistics GetIcmpV4Statistics ()
154 throw new NotImplementedException ();
157 public override IcmpV6Statistics GetIcmpV6Statistics ()
159 throw new NotImplementedException ();
162 public override IPGlobalStatistics GetIPv4GlobalStatistics ()
164 throw new NotImplementedException ();
167 public override IPGlobalStatistics GetIPv6GlobalStatistics ()
169 throw new NotImplementedException ();
172 public override TcpStatistics GetTcpIPv4Statistics ()
174 throw new NotImplementedException ();
177 public override TcpStatistics GetTcpIPv6Statistics ()
179 throw new NotImplementedException ();
182 public override UdpStatistics GetUdpIPv4Statistics ()
184 throw new NotImplementedException ();
187 public override UdpStatistics GetUdpIPv6Statistics ()
189 throw new NotImplementedException ();
193 sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties
195 public override string DomainName {
202 // It expects /proc/net/snmp (or /usr/compat/linux/proc/net/snmp),
204 // http://www.linuxdevcenter.com/linux/2000/11/16/example5.html
205 // http://www.linuxdevcenter.com/linux/2000/11/16/example2.html
206 class MibIPGlobalProperties : UnixIPGlobalProperties
208 public const string ProcDir = "/proc";
209 public const string CompatProcDir = "/usr/compat/linux/proc";
211 public readonly string StatisticsFile, StatisticsFileIPv6, TcpFile, Tcp6File, UdpFile, Udp6File;
213 public MibIPGlobalProperties (string procDir)
215 StatisticsFile = Path.Combine (procDir, "net/snmp");
216 StatisticsFileIPv6 = Path.Combine (procDir, "net/snmp6");
217 TcpFile = Path.Combine (procDir,"net/tcp");
218 Tcp6File = Path.Combine (procDir,"net/tcp6");
219 UdpFile = Path.Combine (procDir,"net/udp");
220 Udp6File = Path.Combine (procDir,"net/udp6");
223 StringDictionary GetProperties4 (string item)
225 string file = StatisticsFile;
227 string head = item + ": ";
228 using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) {
229 string [] keys = null;
230 string [] values = null;
231 string s = String.Empty;
234 if (String.IsNullOrEmpty (s))
236 if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0)
239 keys = s.Substring (head.Length).Split (' ');
240 else if (values != null)
241 // hmm, there may be better error type...
242 throw CreateException (file, String.Format ("Found duplicate line for values for the same item '{0}'", item));
244 values = s.Substring (head.Length).Split (' ');
247 } while (!sr.EndOfStream);
250 throw CreateException (file, String.Format ("No corresponding line was not found for '{0}'", item));
251 if (keys.Length != values.Length)
252 throw CreateException (file, String.Format ("The counts in the header line and the value line do not match for '{0}'", item));
253 StringDictionary dic = new StringDictionary ();
254 for (int i = 0; i < keys.Length; i++)
255 dic [keys [i]] = values [i];
260 StringDictionary GetProperties6 (string item)
262 if (!File.Exists (StatisticsFileIPv6))
263 throw new NetworkInformationException ();
265 string file = StatisticsFileIPv6;
268 using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) {
269 StringDictionary dic = new StringDictionary ();
270 string s = String.Empty;
273 if (String.IsNullOrEmpty (s))
275 if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0)
277 int idx = s.IndexOfAny (wsChars, head.Length);
279 throw CreateException (file, null);
280 dic [s.Substring (head.Length, idx - head.Length)] = s.Substring (idx + 1).Trim (wsChars);
281 } while (!sr.EndOfStream);
287 static readonly char [] wsChars = new char [] {' ', '\t'};
289 Exception CreateException (string file, string msg)
291 return new InvalidOperationException (String.Format ("Unsupported (unexpected) '{0}' file format. ", file) + msg);
293 IPEndPoint [] GetLocalAddresses (List<string []> list)
295 IPEndPoint [] ret = new IPEndPoint [list.Count];
296 for (int i = 0; i < ret.Length; i++)
297 ret [i] = ToEndpoint (list [i] [1]);
301 IPEndPoint ToEndpoint (string s)
303 int idx = s.IndexOf (':');
304 int port = int.Parse (s.Substring (idx + 1), NumberStyles.HexNumber);
306 return new IPEndPoint (long.Parse (s.Substring (0, idx), NumberStyles.HexNumber), port);
308 byte [] bytes = new byte [16];
309 for (int i = 0; (i << 1) < idx; i++)
310 bytes [i] = byte.Parse (s.Substring (i << 1, 2), NumberStyles.HexNumber);
311 return new IPEndPoint (new IPAddress (bytes), port);
315 void GetRows (string file, List<string []> list)
317 if (!File.Exists (file))
319 using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) {
320 sr.ReadLine (); // skip first line
321 while (!sr.EndOfStream) {
322 string [] item = sr.ReadLine ().Split (wsChars, StringSplitOptions.RemoveEmptyEntries);
324 throw CreateException (file, null);
330 public override TcpConnectionInformation [] GetActiveTcpConnections ()
332 List<string []> list = new List<string []> ();
333 GetRows (TcpFile, list);
334 GetRows (Tcp6File, list);
336 TcpConnectionInformation [] ret = new TcpConnectionInformation [list.Count];
337 for (int i = 0; i < ret.Length; i++) {
338 // sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
339 IPEndPoint local = ToEndpoint (list [i] [1]);
340 IPEndPoint remote = ToEndpoint (list [i] [2]);
341 TcpState state = (TcpState) int.Parse (list [i] [3], NumberStyles.HexNumber);
342 ret [i] = new TcpConnectionInformationImpl (local, remote, state);
347 public override IPEndPoint [] GetActiveTcpListeners ()
349 List<string []> list = new List<string []> ();
350 GetRows (TcpFile, list);
351 GetRows (Tcp6File, list);
352 return GetLocalAddresses (list);
355 public override IPEndPoint [] GetActiveUdpListeners ()
357 List<string []> list = new List<string []> ();
358 GetRows (UdpFile, list);
359 GetRows (Udp6File, list);
360 return GetLocalAddresses (list);
363 public override IcmpV4Statistics GetIcmpV4Statistics ()
365 return new MibIcmpV4Statistics (GetProperties4 ("Icmp"));
368 public override IcmpV6Statistics GetIcmpV6Statistics ()
370 return new MibIcmpV6Statistics (GetProperties6 ("Icmp6"));
373 public override IPGlobalStatistics GetIPv4GlobalStatistics ()
375 return new MibIPGlobalStatistics (GetProperties4 ("Ip"));
378 public override IPGlobalStatistics GetIPv6GlobalStatistics ()
380 return new MibIPGlobalStatistics (GetProperties6 ("Ip6"));
383 public override TcpStatistics GetTcpIPv4Statistics ()
385 return new MibTcpStatistics (GetProperties4 ("Tcp"));
388 public override TcpStatistics GetTcpIPv6Statistics ()
390 // There is no TCP info in /proc/net/snmp,
391 // so it is shared with IPv4 info.
392 return new MibTcpStatistics (GetProperties4 ("Tcp"));
395 public override UdpStatistics GetUdpIPv4Statistics ()
397 return new MibUdpStatistics (GetProperties4 ("Udp"));
400 public override UdpStatistics GetUdpIPv6Statistics ()
402 return new MibUdpStatistics (GetProperties6 ("Udp6"));
406 class Win32IPGlobalProperties : IPGlobalProperties
408 public const int AF_INET = 2;
409 public const int AF_INET6 = 23;
411 // FIXME: it might be getting wrong table. I'm getting
412 // different results from .NET 2.0.
413 unsafe void FillTcpTable (out List<Win32_MIB_TCPROW> tab4, out List<Win32_MIB_TCP6ROW> tab6)
415 tab4 = new List<Win32_MIB_TCPROW> ();
417 GetTcpTable (null, ref size4, true); // get size
418 byte [] bytes4 = new byte [size4];
419 GetTcpTable (bytes4, ref size4, true); // get list
421 int structSize4 = Marshal.SizeOf (typeof (Win32_MIB_TCPROW));
423 fixed (byte* ptr = bytes4) {
424 int count = Marshal.ReadInt32 ((IntPtr) ptr);
425 for (int i = 0; i < count; i++) {
426 Win32_MIB_TCPROW row = new Win32_MIB_TCPROW ();
427 Marshal.PtrToStructure ((IntPtr) (ptr + i * structSize4 + 4), row);
432 tab6 = new List<Win32_MIB_TCP6ROW> ();
433 if (Environment.OSVersion.Version.Major >= 6) { // Vista
435 GetTcp6Table (null, ref size6, true); // get size
436 byte [] bytes6 = new byte [size6];
437 GetTcp6Table (bytes6, ref size6, true); // get list
439 int structSize6 = Marshal.SizeOf (typeof (Win32_MIB_TCP6ROW));
441 fixed (byte* ptr = bytes6) {
442 int count = Marshal.ReadInt32 ((IntPtr) ptr);
443 for (int i = 0; i < count; i++) {
444 Win32_MIB_TCP6ROW row = new Win32_MIB_TCP6ROW ();
445 Marshal.PtrToStructure ((IntPtr) (ptr + i * structSize6 + 4), row);
452 bool IsListenerState (TcpState state)
455 case TcpState.SynSent:
456 case TcpState.Listen:
457 case TcpState.FinWait1:
458 case TcpState.FinWait2:
459 case TcpState.CloseWait:
465 public override TcpConnectionInformation [] GetActiveTcpConnections ()
467 List<Win32_MIB_TCPROW> tab4 = null;
468 List<Win32_MIB_TCP6ROW> tab6 = null;
469 FillTcpTable (out tab4, out tab6);
470 int size4 = tab4.Count;
472 TcpConnectionInformation [] ret = new TcpConnectionInformation [size4 + tab6.Count];
473 for (int i = 0; i < size4; i++)
474 ret [i] = tab4 [i].TcpInfo;
475 for (int i = 0; i < tab6.Count; i++)
476 ret [size4 + i] = tab6 [i].TcpInfo;
480 public override IPEndPoint [] GetActiveTcpListeners ()
482 List<Win32_MIB_TCPROW> tab4 = null;
483 List<Win32_MIB_TCP6ROW> tab6 = null;
484 FillTcpTable (out tab4, out tab6);
486 List<IPEndPoint> ret = new List<IPEndPoint> ();
487 for (int i = 0, count = tab4.Count; i < count; i++)
488 if (IsListenerState (tab4 [i].State))
489 ret.Add (tab4 [i].LocalEndPoint);
490 for (int i = 0, count = tab6.Count; i < count; i++)
491 if (IsListenerState (tab6 [i].State))
492 ret.Add (tab6 [i].LocalEndPoint);
493 return ret.ToArray ();
496 public unsafe override IPEndPoint [] GetActiveUdpListeners ()
498 List<IPEndPoint> list = new List<IPEndPoint> ();
500 byte [] bytes4 = null;
502 GetUdpTable (null, ref size4, true); // get size
503 bytes4 = new byte [size4];
504 GetUdpTable (bytes4, ref size4, true); // get list
506 int structSize4 = Marshal.SizeOf (typeof (Win32_MIB_UDPROW));
508 fixed (byte* ptr = bytes4) {
509 int count = Marshal.ReadInt32 ((IntPtr) ptr);
510 for (int i = 0; i < count; i++) {
511 Win32_MIB_UDPROW row = new Win32_MIB_UDPROW ();
512 Marshal.PtrToStructure ((IntPtr) (ptr + i * structSize4 + 4), row);
513 list.Add (row.LocalEndPoint);
517 if (Environment.OSVersion.Version.Major >= 6) { // Vista
518 byte [] bytes6 = null;
520 GetUdp6Table (null, ref size6, true); // get size
521 bytes6 = new byte [size6];
522 GetUdp6Table (bytes6, ref size6, true); // get list
524 int structSize6 = Marshal.SizeOf (typeof (Win32_MIB_UDP6ROW));
526 fixed (byte* ptr = bytes6) {
527 int count = Marshal.ReadInt32 ((IntPtr) ptr);
528 for (int i = 0; i < count; i++) {
529 Win32_MIB_UDP6ROW row = new Win32_MIB_UDP6ROW ();
530 Marshal.PtrToStructure ((IntPtr) (ptr + i * structSize6 + 4), row);
531 list.Add (row.LocalEndPoint);
536 return list.ToArray ();
539 public override IcmpV4Statistics GetIcmpV4Statistics ()
541 if (!Socket.SupportsIPv4)
542 throw new NetworkInformationException ();
543 Win32_MIBICMPINFO stats;
544 GetIcmpStatistics (out stats, AF_INET);
545 return new Win32IcmpV4Statistics (stats);
548 public override IcmpV6Statistics GetIcmpV6Statistics ()
550 if (!Socket.OSSupportsIPv6)
551 throw new NetworkInformationException ();
552 Win32_MIB_ICMP_EX stats;
553 GetIcmpStatisticsEx (out stats, AF_INET6);
554 return new Win32IcmpV6Statistics (stats);
557 public override IPGlobalStatistics GetIPv4GlobalStatistics ()
559 if (!Socket.SupportsIPv4)
560 throw new NetworkInformationException ();
561 Win32_MIB_IPSTATS stats;
562 GetIpStatisticsEx (out stats, AF_INET);
563 return new Win32IPGlobalStatistics (stats);
566 public override IPGlobalStatistics GetIPv6GlobalStatistics ()
568 if (!Socket.OSSupportsIPv6)
569 throw new NetworkInformationException ();
570 Win32_MIB_IPSTATS stats;
571 GetIpStatisticsEx (out stats, AF_INET6);
572 return new Win32IPGlobalStatistics (stats);
575 public override TcpStatistics GetTcpIPv4Statistics ()
577 if (!Socket.SupportsIPv4)
578 throw new NetworkInformationException ();
579 Win32_MIB_TCPSTATS stats;
580 GetTcpStatisticsEx (out stats, AF_INET);
581 return new Win32TcpStatistics (stats);
584 public override TcpStatistics GetTcpIPv6Statistics ()
586 if (!Socket.OSSupportsIPv6)
587 throw new NetworkInformationException ();
588 Win32_MIB_TCPSTATS stats;
589 GetTcpStatisticsEx (out stats, AF_INET6);
590 return new Win32TcpStatistics (stats);
593 public override UdpStatistics GetUdpIPv4Statistics ()
595 if (!Socket.SupportsIPv4)
596 throw new NetworkInformationException ();
597 Win32_MIB_UDPSTATS stats;
598 GetUdpStatisticsEx (out stats, AF_INET);
599 return new Win32UdpStatistics (stats);
602 public override UdpStatistics GetUdpIPv6Statistics ()
604 if (!Socket.OSSupportsIPv6)
605 throw new NetworkInformationException ();
606 Win32_MIB_UDPSTATS stats;
607 GetUdpStatisticsEx (out stats, AF_INET6);
608 return new Win32UdpStatistics (stats);
611 public override string DhcpScopeName {
612 get { return Win32_FIXED_INFO.Instance.ScopeId; }
615 public override string DomainName {
616 get { return Win32_FIXED_INFO.Instance.DomainName; }
619 public override string HostName {
620 get { return Win32_FIXED_INFO.Instance.HostName; }
623 public override bool IsWinsProxy {
624 get { return Win32_FIXED_INFO.Instance.EnableProxy != 0; }
627 public override NetBiosNodeType NodeType {
628 get { return Win32_FIXED_INFO.Instance.NodeType; }
633 [DllImport ("iphlpapi.dll")]
634 static extern int GetTcpTable (byte [] pTcpTable, ref int pdwSize, bool bOrder);
636 [DllImport ("iphlpapi.dll")]
637 static extern int GetTcp6Table (byte [] TcpTable, ref int SizePointer, bool Order);
639 [DllImport ("iphlpapi.dll")]
640 static extern int GetUdpTable (byte [] pUdpTable, ref int pdwSize, bool bOrder);
642 [DllImport ("iphlpapi.dll")]
643 static extern int GetUdp6Table (byte [] Udp6Table, ref int SizePointer, bool Order);
645 [DllImport ("iphlpapi.dll")]
646 static extern int GetTcpStatisticsEx (out Win32_MIB_TCPSTATS pStats, int dwFamily);
648 [DllImport ("iphlpapi.dll")]
649 static extern int GetUdpStatisticsEx (out Win32_MIB_UDPSTATS pStats, int dwFamily);
651 [DllImport ("iphlpapi.dll")]
652 static extern int GetIcmpStatistics (out Win32_MIBICMPINFO pStats, int dwFamily);
654 [DllImport ("iphlpapi.dll")]
655 static extern int GetIcmpStatisticsEx (out Win32_MIB_ICMP_EX pStats, int dwFamily);
657 [DllImport ("iphlpapi.dll")]
658 static extern int GetIpStatisticsEx (out Win32_MIB_IPSTATS pStats, int dwFamily);
662 [StructLayout (LayoutKind.Explicit)]
663 struct Win32_IN6_ADDR
666 [MarshalAs ( UnmanagedType.ByValArray, SizeConst = 16)]
667 public byte [] Bytes;
670 [StructLayout (LayoutKind.Sequential)]
671 class Win32_MIB_TCPROW
673 public TcpState State;
674 public uint LocalAddr;
675 public int LocalPort;
676 public uint RemoteAddr;
677 public int RemotePort;
679 public IPEndPoint LocalEndPoint {
680 get { return new IPEndPoint (LocalAddr, LocalPort); }
683 public IPEndPoint RemoteEndPoint {
684 get { return new IPEndPoint (RemoteAddr, RemotePort); }
687 public TcpConnectionInformation TcpInfo {
688 get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
692 [StructLayout (LayoutKind.Sequential)]
693 class Win32_MIB_TCP6ROW
695 public TcpState State;
696 public Win32_IN6_ADDR LocalAddr;
697 public uint LocalScopeId;
698 public int LocalPort;
699 public Win32_IN6_ADDR RemoteAddr;
700 public uint RemoteScopeId;
701 public int RemotePort;
703 public IPEndPoint LocalEndPoint {
704 get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }
707 public IPEndPoint RemoteEndPoint {
708 get { return new IPEndPoint (new IPAddress (RemoteAddr.Bytes, RemoteScopeId), RemotePort); }
711 public TcpConnectionInformation TcpInfo {
712 get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
716 [StructLayout (LayoutKind.Sequential)]
717 class Win32_MIB_UDPROW
719 public uint LocalAddr;
720 public int LocalPort;
722 public IPEndPoint LocalEndPoint {
723 get { return new IPEndPoint (LocalAddr, LocalPort); }
727 [StructLayout (LayoutKind.Sequential)]
728 class Win32_MIB_UDP6ROW
730 public Win32_IN6_ADDR LocalAddr;
731 public uint LocalScopeId;
732 public int LocalPort;
734 public IPEndPoint LocalEndPoint {
735 get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }