Beispiel #1
0
 public override void Create(System.Net.Sockets.AddressFamily af, System.Net.Sockets.SocketType type, System.Net.Sockets.ProtocolType proto)
 {
     lock (m_syncRoot)
     {
         m_socket = new Socket(af, type, proto);
     }
 }
 public IPAddress(byte[] address)
 {
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     if ((address.Length != 4) && (address.Length != 0x10))
     {
         throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
     }
     if (address.Length == 4)
     {
         this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
         this.m_Address = ((((address[3] << 0x18) | (address[2] << 0x10)) | (address[1] << 8)) | address[0]) & ((long)0xffffffffL);
     }
     else
     {
         this.m_Family = System.Net.Sockets.AddressFamily.InterNetworkV6;
         for (int i = 0; i < 8; i++)
         {
             this.m_Numbers[i] = (ushort)((address[i * 2] * 0x100) + address[(i * 2) + 1]);
         }
     }
 }
 public GeneralSocket(System.Net.Sockets.AddressFamily addressFamily,
                      System.Net.Sockets.SocketType socketType,
                      System.Net.Sockets.ProtocolType protocolType,
                      System.Net.EndPoint localEndPoint) : base(addressFamily, socketType, protocolType)
 {
     base.Bind(localEndPoint);
 }
Beispiel #4
0
        /// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as a <see cref="T:System.Byte" /> array.</summary>
        /// <param name="address">The byte array value of the IP address. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="address" /> is null. </exception>
        public IPAddress(byte[] address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }
            int num = address.Length;

            if (num != 16 && num != 4)
            {
                throw new ArgumentException("An invalid IP address was specified.", "address");
            }
            if (num == 16)
            {
                this.m_Numbers = new ushort[8];
                Buffer.BlockCopy(address, 0, this.m_Numbers, 0, 16);
                this.m_Family  = System.Net.Sockets.AddressFamily.InterNetworkV6;
                this.m_ScopeId = 0L;
            }
            else
            {
                this.m_Address = (long)((ulong)((ulong)address[3] << 24) + (ulong)((long)((long)address[2] << 16)) + (ulong)((long)((long)address[1] << 8)) + (ulong)((long)address[0]));
                this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
            }
        }
Beispiel #5
0
 public RemoteExecServer(SNS.AddressFamily addressFamily, int port, int timeoutSec, string stopFile)
 {
     _addressFamily = addressFamily;
     _port          = port;
     _timeoutSec    = timeoutSec;
     _stopFile      = stopFile;
 }
 public IPAddress(byte[] address)
 {
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     if ((address.Length != 4) && (address.Length != 0x10))
     {
         throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
     }
     if (address.Length == 4)
     {
         this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
         this.m_Address = ((((address[3] << 0x18) | (address[2] << 0x10)) | (address[1] << 8)) | address[0]) & ((long) 0xffffffffL);
     }
     else
     {
         this.m_Family = System.Net.Sockets.AddressFamily.InterNetworkV6;
         for (int i = 0; i < 8; i++)
         {
             this.m_Numbers[i] = (ushort) ((address[i * 2] * 0x100) + address[(i * 2) + 1]);
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// 현재 주소를 가져온다.
        /// </summary>
        /// <returns></returns>
        public static string[] MyIp(System.Net.Sockets.AddressFamily addFamily = System.Net.Sockets.AddressFamily.InterNetwork)
        {
            try
            {
                string hostString = Dns.GetHostName();

                var ip = Dns.GetHostAddresses(hostString).Where(s => s.AddressFamily == addFamily);

                int      cnt = ip.Count();
                int      idx = 0;
                string[] rtn = new string[cnt];

                foreach (IPAddress i in ip)
                {
                    rtn[idx] = i.ToString();
                    idx++;
                }


                return(rtn);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #8
0
        public override void Create(System.Net.Sockets.AddressFamily af, System.Net.Sockets.SocketType type, System.Net.Sockets.ProtocolType proto)
        {
            lock (m_syncRoot)
            {
                m_socket          = new ElServerSSLSocket(new Socket(af, type, proto));
                m_socket.Versions = m_protocols;

                // To speed the answer, we're using only the fastest cipher suites (based on experimentation ...)
                for (short i = SBSSLConstants.__Global.SB_SUITE_FIRST; i < SBSSLConstants.__Global.SB_SUITE_LAST; i++)
                {
                    m_socket.set_CipherSuites(i, false);
                }

                // let the user overide cipher suites if they desire
                if (m_config.Security.CipherList != null && m_config.Security.CipherList.Count > 0)
                {
                    foreach (var c in m_config.Security.CipherList)
                    {
                        m_socket.set_CipherSuites(c, true);
                    }
                }
                else
                {
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_3DES_SHA, true);
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_AES128_SHA, true);
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_AES256_SHA, true);
                }

                m_socket.CustomCertStorage = m_certStorage;
                m_socket.OnError          += new SBSSLCommon.TSBErrorEvent(m_socket_OnError);
            }
        }
 public HyperVSocketEndPoint(System.Net.Sockets.AddressFamily AddrFamily,
                            Guid VmId,
                            Guid ServiceId)
 {
     _addressFamily = AddrFamily;
     _vmId = VmId;
     _serviceId = ServiceId;
 }
 private IPAddress(ushort[] address, uint scopeid)
 {
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetworkV6;
     this.m_Numbers = address;
     this.m_ScopeId = scopeid;
 }
 public HyperVSocketEndPoint(System.Net.Sockets.AddressFamily AddrFamily,
                             Guid VmId,
                             Guid ServiceId)
 {
     _addressFamily = AddrFamily;
     _vmId          = VmId;
     _serviceId     = ServiceId;
 }
Beispiel #12
0
 public FileWarpServer(SNS.AddressFamily addressFamily, int port, int timeoutSec, string stopFile, string fileSite)
 {
     _addressFamily = addressFamily;
     _port          = port;
     _timeoutSec    = timeoutSec;
     _stopFile      = stopFile;
     _fileSite      = fileSite;
 }
Beispiel #13
0
 public Socket(ns.AddressFamily addressFamily, ns.SocketType socketType, ns.ProtocolType protocolType)
     : base(addressFamily, socketType, protocolType)
 {
     lock (_socklist)
     {
         _socklist.Add(FD, this);
     }
     //EDB.WriteLine("Making socket w/ FD=" + FD);
 }
 public IPAddress(long newAddress)
 {
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if ((newAddress < 0L) || (newAddress > 0xffffffffL))
     {
         throw new ArgumentOutOfRangeException("newAddress");
     }
     this.m_Address = newAddress;
 }
Beispiel #15
0
 internal IPAddress(ushort[] address, long scopeId)
 {
     this.m_Numbers = address;
     for (int i = 0; i < 8; i++)
     {
         this.m_Numbers[i] = (ushort)IPAddress.HostToNetworkOrder((short)this.m_Numbers[i]);
     }
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetworkV6;
     this.m_ScopeId = scopeId;
 }
 public IPAddress(long newAddress)
 {
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if ((newAddress < 0L) || (newAddress > 0xffffffffL))
     {
         throw new ArgumentOutOfRangeException("newAddress");
     }
     this.m_Address = newAddress;
 }
Beispiel #17
0
 public Socket(ns.AddressFamily addressFamily, ns.SocketType socketType, ns.ProtocolType protocolType)
     : base(addressFamily, socketType, protocolType)
 {
     if (_socklist == null)
     {
         _socklist = new SortedList <uint, Socket>();
     }
     _socklist.Add(FD, this);
     //EDB.WriteLine("Making socket w/ FD=" + FD);
 }
 /// <summary>Creates a new instance of the <see cref="T:System.Net.SocketAddress" /> class using the specified address family and buffer size.</summary>
 /// <param name="family">An <see cref="T:System.Net.Sockets.AddressFamily" /> enumerated value. </param>
 /// <param name="size">The number of bytes to allocate for the underlying buffer. </param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="size" /> is less than 2. These 2 bytes are needed to store <paramref name="family" />. </exception>
 public SocketAddress(System.Net.Sockets.AddressFamily family, int size)
 {
     if (size < 2)
     {
         throw new ArgumentOutOfRangeException("size is too small");
     }
     this.data    = new byte[size];
     this.data[0] = (byte)family;
     this.data[1] = (byte)(family >> 8);
 }
Beispiel #19
0
        /// <summary>Creates an endpoint from a socket address.</summary>
        /// <returns>An <see cref="T:System.Net.EndPoint" /> instance using the specified socket address.</returns>
        /// <param name="socketAddress">The <see cref="T:System.Net.SocketAddress" /> to use for the endpoint. </param>
        /// <exception cref="T:System.ArgumentException">The AddressFamily of <paramref name="socketAddress" /> is not equal to the AddressFamily of the current instance.-or- <paramref name="socketAddress" />.Size &lt; 8. </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
        /// </PermissionSet>
        public override EndPoint Create(SocketAddress socketAddress)
        {
            if (socketAddress == null)
            {
                throw new ArgumentNullException("socketAddress");
            }
            if (socketAddress.Family != this.AddressFamily)
            {
                throw new ArgumentException(string.Concat(new object[]
                {
                    "The IPEndPoint was created using ",
                    this.AddressFamily,
                    " AddressFamily but SocketAddress contains ",
                    socketAddress.Family,
                    " instead, please use the same type."
                }));
            }
            int size = socketAddress.Size;

            System.Net.Sockets.AddressFamily family        = socketAddress.Family;
            System.Net.Sockets.AddressFamily addressFamily = family;
            IPEndPoint result;

            if (addressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
            {
                if (addressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
                {
                    return(null);
                }
                if (size < 28)
                {
                    return(null);
                }
                int      num   = ((int)socketAddress[2] << 8) + (int)socketAddress[3];
                int      num2  = (int)socketAddress[24] + ((int)socketAddress[25] << 8) + ((int)socketAddress[26] << 16) + ((int)socketAddress[27] << 24);
                ushort[] array = new ushort[8];
                for (int i = 0; i < 8; i++)
                {
                    array[i] = (ushort)(((int)socketAddress[8 + i * 2] << 8) + (int)socketAddress[8 + i * 2 + 1]);
                }
                result = new IPEndPoint(new IPAddress(array, (long)num2), num);
            }
            else
            {
                if (size < 8)
                {
                    return(null);
                }
                int  num   = ((int)socketAddress[2] << 8) + (int)socketAddress[3];
                long iaddr = ((long)socketAddress[7] << 24) + ((long)socketAddress[6] << 16) + ((long)socketAddress[5] << 8) + (long)socketAddress[4];
                result = new IPEndPoint(iaddr, num);
            }
            return(result);
        }
Beispiel #20
0
 public static IPAddress GetFirstIPAddress(System.Net.Sockets.AddressFamily addressFamily)
 {
     foreach (System.Net.IPAddress ip in System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList)
     {
         if (ip.AddressFamily == addressFamily)
         {
             return(ip);
         }
     }
     return(IPAddress.Loopback);
 }
 internal IPAddress Snapshot()
 {
     System.Net.Sockets.AddressFamily family = this.m_Family;
     if (family != System.Net.Sockets.AddressFamily.InterNetwork)
     {
         if (family != System.Net.Sockets.AddressFamily.InterNetworkV6)
         {
             throw new InternalException();
         }
         return(new IPAddress(this.m_Numbers, (uint)this.m_ScopeId));
     }
     return(new IPAddress(this.m_Address));
 }
Beispiel #22
0
        protected IPAddress GetServerIpAddress(SNS.AddressFamily addressFamily, string server)
        {
            foreach (IPAddress address in Dns.GetHostAddresses(server))
            {
                if (address.AddressFamily == addressFamily)
                {
                    return(address);
                }
            }

            string str = string.Format("Cant find ip address for server [{0}] on protocol [{1}].", server, addressFamily.ToString());

            throw new SocketException(str);
        }
Beispiel #23
0
        private static string GetIP(System.Net.Sockets.AddressFamily addressFamily)
        {
            string ip        = string.Empty;
            var    ipAddress = Dns.GetHostAddresses(GetHostName());

            if (!ipAddress.IfIsNullOrEmpty())
            {
                var result = ipAddress.FirstOrDefault(p => p.AddressFamily == addressFamily);
                if (!result.IfIsNullOrEmpty())
                {
                    ip = result.ToString();
                }
            }
            return(ip);
        }
Beispiel #24
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as a <see cref="T:System.Byte" /> array and the specified scope identifier.</summary>
 /// <param name="address">The byte array value of the IP address. </param>
 /// <param name="scopeid">The long value of the scope identifier. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="address" /> is null. </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="scopeid" /> &lt; 0 or <paramref name="scopeid" /> &gt; 0x00000000FFFFFFFF </exception>
 public IPAddress(byte[] address, long scopeId)
 {
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     if (address.Length != 16)
     {
         throw new ArgumentException("An invalid IP address was specified.", "address");
     }
     this.m_Numbers = new ushort[8];
     Buffer.BlockCopy(address, 0, this.m_Numbers, 0, 16);
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetworkV6;
     this.m_ScopeId = scopeId;
 }
Beispiel #25
0
        public void Connect(SNS.AddressFamily addressFamily, string server, int port)
        {
            IPAddress  ip = GetServerIpAddress(addressFamily, server);
            IPEndPoint ep = new IPEndPoint(ip, port);

            //Console.WriteLine( "SocketClient - connecting to server [{0}] [{2}:{1}] ", server, port, ip.ToString()  ) ;

            _socket = new SNS.Socket(addressFamily, SNS.SocketType.Stream, SNS.ProtocolType.Tcp);
            _socket.Connect(ep);

            _connected = true;

            _socket.SetSocketOption(SNS.SocketOptionLevel.Socket, SNS.SocketOptionName.Linger, new SNS.LingerOption(false, 0));
            _socket.SetSocketOption(SNS.SocketOptionLevel.Socket, SNS.SocketOptionName.ReceiveBuffer, SocketConstants.SOCKET_MAX_TRANSFER_BYTES);
            _socket.SetSocketOption(SNS.SocketOptionLevel.Socket, SNS.SocketOptionName.SendBuffer, SocketConstants.SOCKET_MAX_TRANSFER_BYTES);
            _socket.SetSocketOption(SNS.SocketOptionLevel.Tcp, SNS.SocketOptionName.NoDelay, 1);
        }
Beispiel #26
0
            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="addressFamily">The ip address family.</param>
            public UdpSimpleContext(System.Net.Sockets.AddressFamily addressFamily)
            {
                _readBuffer  = new byte[READ_BUFFER_SIZE];
                _writeBuffer = new byte[WRITE_BUFFER_SIZE];

                // Creates an IpEndPoint to capture the identity of the client.
                if (addressFamily == AddressFamily.InterNetwork)
                {
                    _client = new IPEndPoint(IPAddress.Any, 0);
                }

                if (addressFamily == AddressFamily.InterNetworkV6)
                {
                    _client = new IPEndPoint(IPAddress.IPv6Any, 0);
                }

                RemoteClient = (EndPoint)_client;
            }
 public DnsEndPoint(string host, int port, System.Net.Sockets.AddressFamily addressFamily)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (string.IsNullOrEmpty(host))
     {
         throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "host" }));
     }
     if ((port < 0) || (port > 0xffff))
     {
         throw new ArgumentOutOfRangeException("port");
     }
     if (((addressFamily != System.Net.Sockets.AddressFamily.InterNetwork) && (addressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)) && (addressFamily != System.Net.Sockets.AddressFamily.Unspecified))
     {
         throw new ArgumentException(SR.GetString("net_sockets_invalid_optionValue_all"), "addressFamily");
     }
     this.m_Host = host;
     this.m_Port = port;
     this.m_Family = addressFamily;
 }
 public DnsEndPoint(string host, int port, System.Net.Sockets.AddressFamily addressFamily)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (string.IsNullOrEmpty(host))
     {
         throw new ArgumentException(SR.GetString("net_emptystringcall", new object[] { "host" }));
     }
     if ((port < 0) || (port > 0xffff))
     {
         throw new ArgumentOutOfRangeException("port");
     }
     if (((addressFamily != System.Net.Sockets.AddressFamily.InterNetwork) && (addressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)) && (addressFamily != System.Net.Sockets.AddressFamily.Unspecified))
     {
         throw new ArgumentException(SR.GetString("net_sockets_invalid_optionValue_all"), "addressFamily");
     }
     this.m_Host   = host;
     this.m_Port   = port;
     this.m_Family = addressFamily;
 }
 public IPAddress(byte[] address, long scopeid)
 {
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     if (address.Length != 0x10)
     {
         throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
     }
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetworkV6;
     for (int i = 0; i < 8; i++)
     {
         this.m_Numbers[i] = (ushort)((address[i * 2] * 0x100) + address[(i * 2) + 1]);
     }
     if ((scopeid < 0L) || (scopeid > 0xffffffffL))
     {
         throw new ArgumentOutOfRangeException("scopeid");
     }
     this.m_ScopeId = scopeid;
 }
Beispiel #30
0
        /// <summary>Serializes endpoint information into a <see cref="T:System.Net.SocketAddress" /> instance.</summary>
        /// <returns>A <see cref="T:System.Net.SocketAddress" /> instance containing the socket address for the endpoint.</returns>
        public override SocketAddress Serialize()
        {
            SocketAddress socketAddress = null;

            System.Net.Sockets.AddressFamily addressFamily = this.address.AddressFamily;
            if (addressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
            {
                if (addressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
                {
                    socketAddress    = new SocketAddress(System.Net.Sockets.AddressFamily.InterNetworkV6, 28);
                    socketAddress[2] = (byte)(this.port >> 8 & 255);
                    socketAddress[3] = (byte)(this.port & 255);
                    byte[] addressBytes = this.address.GetAddressBytes();
                    for (int i = 0; i < 16; i++)
                    {
                        socketAddress[8 + i] = addressBytes[i];
                    }
                    socketAddress[24] = (byte)(this.address.ScopeId & 255L);
                    socketAddress[25] = (byte)(this.address.ScopeId >> 8 & 255L);
                    socketAddress[26] = (byte)(this.address.ScopeId >> 16 & 255L);
                    socketAddress[27] = (byte)(this.address.ScopeId >> 24 & 255L);
                }
            }
            else
            {
                socketAddress    = new SocketAddress(System.Net.Sockets.AddressFamily.InterNetwork, 16);
                socketAddress[2] = (byte)(this.port >> 8 & 255);
                socketAddress[3] = (byte)(this.port & 255);
                long internalIPv4Address = this.address.InternalIPv4Address;
                socketAddress[4] = (byte)(internalIPv4Address & 255L);
                socketAddress[5] = (byte)(internalIPv4Address >> 8 & 255L);
                socketAddress[6] = (byte)(internalIPv4Address >> 16 & 255L);
                socketAddress[7] = (byte)(internalIPv4Address >> 24 & 255L);
            }
            return(socketAddress);
        }
Beispiel #31
0
        public static void GetAdaptersAddresses(System.Net.Sockets.AddressFamily addressFamily,
                                                NetDisc.GAA_FLAGS gaaFlags,
                                                out List <IP_ADAPTER_ADDRESSES> adaptAddrList)
        {
            adaptAddrList = new List <IP_ADAPTER_ADDRESSES>();
            UInt32 size             = (UInt32)Marshal.SizeOf(typeof(IP_ADAPTER_ADDRESSES));
            IntPtr pAdaptAddrBuffer = Marshal.AllocHGlobal((Int32)size);

            uint result = GetAdaptersAddresses((UInt32)addressFamily, (UInt32)gaaFlags, (IntPtr)0, pAdaptAddrBuffer, ref size);

            if (result == NetDisc.ERROR_BUFFER_OVERFLOW)
            {
                Marshal.FreeHGlobal(pAdaptAddrBuffer);
                pAdaptAddrBuffer = Marshal.AllocHGlobal((Int32)size);
                result           = GetAdaptersAddresses((UInt32)addressFamily, (UInt32)gaaFlags, (IntPtr)0, pAdaptAddrBuffer, ref size);
            }

            if (result != NetDisc.ERROR_SUCCESS)
            {
                throw new Win32Exception((Int32)result, "GetAdaptersAddresses FAILED.");
            }

            if ((result == NetDisc.ERROR_SUCCESS) && (pAdaptAddrBuffer != IntPtr.Zero))
            {
                IntPtr pTemp = pAdaptAddrBuffer;

                do
                {
                    IP_ADAPTER_ADDRESSES aAB = new IP_ADAPTER_ADDRESSES();
                    aAB = (IP_ADAPTER_ADDRESSES)Marshal.PtrToStructure((IntPtr)pTemp, typeof(IP_ADAPTER_ADDRESSES));
                    adaptAddrList.Add(aAB);

                    pTemp = (IntPtr)aAB.Next;
                }while (pTemp != IntPtr.Zero);
            }
        }
Beispiel #32
0
 public Socket(ns.AddressFamily addressFamily, ns.SocketType socketType, ns.ProtocolType protocolType)
     : this(new ns.Socket(addressFamily, socketType, protocolType))
 {
     //ROS.Debug()( $"[{ThisNode.Name}] Making socket w/ FD={FD}" );
 }
 public IPAddress(byte[] address, long scopeid)
 {
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     if (address.Length != 0x10)
     {
         throw new ArgumentException(SR.GetString("dns_bad_ip_address"), "address");
     }
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetworkV6;
     for (int i = 0; i < 8; i++)
     {
         this.m_Numbers[i] = (ushort) ((address[i * 2] * 0x100) + address[(i * 2) + 1]);
     }
     if ((scopeid < 0L) || (scopeid > 0xffffffffL))
     {
         throw new ArgumentOutOfRangeException("scopeid");
     }
     this.m_ScopeId = scopeid;
 }
 internal IPAddress(int newAddress)
 {
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     this.m_Address = newAddress & ((long) 0xffffffffL);
 }
 private IPAddress(ushort[] address, uint scopeid)
 {
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetwork;
     this.m_Numbers = new ushort[8];
     this.m_Family = System.Net.Sockets.AddressFamily.InterNetworkV6;
     this.m_Numbers = address;
     this.m_ScopeId = scopeid;
 }
Beispiel #36
0
 public FileWarpClient(SNS.AddressFamily addressFamily, string server, int port)
 {
     _addressFamily = addressFamily;
     _server        = server;
     _port          = port;
 }
Beispiel #37
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Net.IPAddress" /> class with the address specified as an <see cref="T:System.Int64" />.</summary>
 /// <param name="newAddress">The long value of the IP address. For example, the value 0x2414188f in big-endian format would be the IP address "143.24.20.36". </param>
 public IPAddress(long addr)
 {
     this.m_Address = addr;
     this.m_Family  = System.Net.Sockets.AddressFamily.InterNetwork;
 }