Package cli.System.Net

Examples of cli.System.Net.IPEndPoint


        }
        try
        {
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            IPEndPoint ep = epw.get();
            if (ep == null)
            {
                // it is a disconnect request, we must connect to the Any address
                if (socket.get_AddressFamily().Value == AddressFamily.InterNetwork)
                {
                    ep = new IPEndPoint(cli.System.Net.IPAddress.Any, 0);
                }
                else
                {
                    ep = new IPEndPoint(cli.System.Net.IPAddress.IPv6Any, 0);
                }
            }
            if (socket.get_SocketType().Value == SocketType.Dgram)
            {
                // NOTE we use async connect to work around the issue that the .NET Socket class disallows sync Connect after the socket has received WSAECONNRESET
View Full Code Here


        try
        {
            if (false) throw new cli.System.ArgumentException();
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            EndPoint[] ep = new EndPoint[] { socket.get_AddressFamily().Value == AF_INET6 ? new IPEndPoint(IPAddress.IPv6Any, 0) : new IPEndPoint(0, 0) };
            try
            {
                return socket.ReceiveFrom(buf, off, len, SocketFlags.wrap(flags), ep);
            }
            finally
View Full Code Here

        }
        try
        {
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            IPEndPoint ep = (IPEndPoint)s.get_LocalEndPoint();
            if (ep == null)
            {
                lastError = WSAEINVAL;
                return SOCKET_ERROR;
            }
View Full Code Here

        if (family == AF_INET) {
            ofamily = AF_INET6;
            fd = b.ipv4_fd;
            ofd = b.ipv6_fd;
            port = GET_PORT (b.addr);
            oaddr.set(new IPEndPoint(IPAddress.IPv6Any, htons(port)));
        } else {
            ofamily = AF_INET;
            ofd = b.ipv4_fd;
            fd = b.ipv6_fd;
            port = GET_PORT (b.addr);
            oaddr.set(new IPEndPoint(IPAddress.Any, htons(port)));
        }

        rv = NET_Bind (fd, b.addr);
        if (rv == SOCKET_ERROR) {
            return CLOSE_SOCKETS_AND_RETURN(fd, ofd, close_fd, close_ofd, b);
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

            }
        }

        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

    {
        try
        {
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            fd.getSocket().Bind(new IPEndPoint(SocketUtil.getAddressFromInetAddress(addr), port));
        }
        catch (cli.System.Net.Sockets.SocketException x)
        {
            throw SocketUtil.convertSocketExceptionToIOException(x);
        }
View Full Code Here

    {
        try
        {
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            IPEndPoint ep = (IPEndPoint)fd.getSocket().get_LocalEndPoint();
            return new InetSocketAddress(SocketUtil.getInetAddressFromIPEndPoint(ep), ep.get_Port());
        }
        catch (cli.System.Net.Sockets.SocketException x)
        {
            throw new Error(x);
        }
View Full Code Here

    {
        try
        {
            if (false) throw new cli.System.Net.Sockets.SocketException();
            if (false) throw new cli.System.ObjectDisposedException("");
            IPEndPoint ep = (IPEndPoint)fd.getSocket().get_LocalEndPoint();
            return ep == null ? 0 : ep.get_Port();
        }
        catch (cli.System.Net.Sockets.SocketException x)
        {
            throw new Error(x);
        }
View Full Code Here

TOP

Related Classes of cli.System.Net.IPEndPoint

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.