IPPacketInformation.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Sockets / IPPacketInformation.cs / 1305376 / 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
} 



 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     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
} 



 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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