Package cli.System.Net

Examples of cli.System.Net.IPAddress


    {
        public int s_addr;

        IPAddress ToIPAddress()
        {
            return new IPAddress(s_addr & 0xFFFFFFFFL);
        }
View Full Code Here


        byte[] b = addr.getAddress();
        if (b.length == 16)
        {
            // FXBUG in .NET 1.1 you can only construct IPv6 addresses (not IPv4) with this constructor
            // (according to the documentation this was fixed in .NET 2.0)
            return new IPAddress(b);
        }
        else
        {
            return new IPAddress((((b[3] & 0xff) << 24) + ((b[2] & 0xff) << 16) + ((b[1] & 0xff) << 8) + (b[0] & 0xff)) & 0xffffffffL);
        }
    }
View Full Code Here

     * v4MappedAddress is TRUE. Otherwise it will return a sockaddr_in
     * structure for an IPv4 InetAddress.
    */
    static int NET_InetAddressToSockaddr(JNIEnv env, InetAddress iaObj, int port, SOCKETADDRESS him, boolean v4MappedAddress) {
        if (iaObj.family == InetAddress.IPv4) {
            him.set(new IPEndPoint(new IPAddress(htonl(iaObj.address) & 0xFFFFFFFFL), port));
            return 0;
        } else {
            Inet6Address v6addr = (Inet6Address)iaObj;
            int scope = v6addr.getScopeId();
            if (scope == 0) {
                him.set(new IPEndPoint(new IPAddress(v6addr.ipaddress), port));
                return 0;
            } else {
                him.set(new IPEndPoint(new IPAddress(v6addr.ipaddress, scope & 0xFFFFFFFFL), port));
                return 0;
            }
        }
    }
View Full Code Here

                    s_addr = (int)ep.get_Address().get_Address();
                    sin6_addr = null;
                    sin6_scope_id = 0;
                } else {
                    s_addr = 0;
                    IPAddress addr = ep.get_Address();
                    sin6_addr = addr.GetAddressBytes();
                    sin6_scope_id = (int)addr.get_ScopeId();
                }
            }
        }
View Full Code Here

            }
        }

        public IPEndPoint get() {
            if (sa_family == AF_INET) {
                return new IPEndPoint(new IPAddress(s_addr & 0xFFFFFFFFL), ntohs(sin_port));
            } else if (sa_family == AF_INET6) {
                IPAddress addr;
                if (sin6_addr == null) {
                    addr = IPAddress.IPv6Any;
                } else {
                    addr = new IPAddress(sin6_addr, sin6_scope_id & 0xFFFFFFFFL);
                }
                return new IPEndPoint(addr, ntohs(sin_port));
            } else {
                return null;
            }
View Full Code Here

TOP

Related Classes of cli.System.Net.IPAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.