IPPacketInformation.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Sockets / IPPacketInformation.cs / 1 / IPPacketInformation.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

 
 
namespace System.Net.Sockets {
    using System.Net; 

    public struct IPPacketInformation {
        IPAddress address;
        int networkInterface; 

        internal IPPacketInformation(IPAddress address, int networkInterface){ 
            this.address = address; 
            this.networkInterface = networkInterface;
        } 

        public IPAddress Address {
            get{
                return address; 
            }
        } 
 
        public int Interface {
            get{ 
                return networkInterface;
            }
        }
 
        public static bool operator == (IPPacketInformation packetInformation1,
                                        IPPacketInformation packetInformation2 ) { 
            return packetInformation1.Equals(packetInformation2); 
        }
 
        public static bool operator != (IPPacketInformation packetInformation1,
                                        IPPacketInformation packetInformation2 ) {
            return !packetInformation1.Equals(packetInformation2);
        } 

        public override bool Equals(object comparand) { 
            if ((object) comparand == null) { 
                return false;
            } 

            if (!(comparand is IPPacketInformation))
                return false;
 
            IPPacketInformation obj = (IPPacketInformation) comparand;
 
            if (address.Equals(obj.address) && networkInterface == obj.networkInterface) 
                return (true);
 
            return false;
        }

        public override int GetHashCode() { 
            return address.GetHashCode() + networkInterface.GetHashCode();
        } 
 
    }; // enum SocketFlags
} 



 



                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK