Package java.nio.channels

Examples of java.nio.channels.SocketChannel.finishConnect()


                            // Complete a connection of a registered channel
                            SocketChannel channel = (SocketChannel)key.channel();
                            boolean connected=false;
                            try
                            {
                                connected=channel.finishConnect();
                            }
                            catch(Exception e)
                            {
                                connectionFailed(channel,e,att);
                            }
View Full Code Here


                    // we were woken up without being selected...poll for thread events and go back to sleep
                    context.pollThreadEvents();
                } else {
                    try {
                        SocketChannel connected = ssc.accept();
                        connected.finishConnect();

                        //
                        // Force the client socket to be blocking
                        //
                        synchronized (connected.blockingLock()) {
View Full Code Here

            boolean success = false;
            try {
                channel.configureBlocking(false);
                channel.connect( new InetSocketAddress(InetAddress.getByName(remoteHost), remotePort) );
                context.getThread().select(channel, this, SelectionKey.OP_CONNECT);
                channel.finishConnect();
                success = true;
            } catch (NoRouteToHostException nrthe) {
                throw context.getRuntime().newErrnoEHOSTUNREACHError("SocketChannel.connect");
            } catch(ConnectException e) {
                throw context.getRuntime().newErrnoECONNREFUSEDError();
View Full Code Here

            SocketChannel ch = ( SocketChannel ) key.channel();
            ConnectionRequest entry = ( ConnectionRequest ) key.attachment();

            try
            {
                ch.finishConnect();
                SocketSession session = newSession( ch, entry.handler );
                entry.session = session;
            }
            catch( Throwable e )
            {
View Full Code Here

                SessionRequestHandle requestHandle = (SessionRequestHandle) key.attachment();
                SessionRequestImpl sessionRequest = requestHandle.getSessionRequest();
               
                // Finish connection process
                try {
                    channel.finishConnect();
                } catch (IOException ex) {
                    sessionRequest.failed(ex);
                }
                key.cancel();
                if (channel.isConnected()) {
View Full Code Here

                SessionRequestHandle requestHandle = (SessionRequestHandle) key.attachment();
                SessionRequestImpl sessionRequest = requestHandle.getSessionRequest();

                // Finish connection process
                try {
                    channel.finishConnect();
                } catch (IOException ex) {
                    sessionRequest.failed(ex);
                }
                key.cancel();
                if (channel.isConnected()) {
View Full Code Here

            SocketChannel ch = (SocketChannel) key.channel();
            ConnectionRequest entry = (ConnectionRequest) key.attachment();

            boolean success = false;
            try {
                ch.finishConnect();
                newSession(ch, entry.handler, entry.config, entry);
                success = true;
            } catch (Throwable e) {
                entry.setException(e);
            } finally {
View Full Code Here

                SessionRequestHandle requestHandle = (SessionRequestHandle) key.attachment();
                SessionRequestImpl sessionRequest = requestHandle.getSessionRequest();
               
                // Finish connection process
                try {
                    channel.finishConnect();
                } catch (IOException ex) {
                    sessionRequest.failed(ex);
                }
                key.cancel();
                if (channel.isConnected()) {
View Full Code Here

                SessionRequestHandle requestHandle = (SessionRequestHandle) key.attachment();
                SessionRequestImpl sessionRequest = requestHandle.getSessionRequest();
               
                // Finish connection process
                try {
                    channel.finishConnect();
                } catch (IOException ex) {
                    sessionRequest.failed(ex);
                }
                key.cancel();
                if (channel.isConnected()) {
View Full Code Here

      SocketChannel socketChannel = (SocketChannel) key.channel();
      if (socketChannel.isConnectionPending()) {

        // TODO Loop? Or may be sleep for while?
        while (socketChannel.isConnectionPending()) {
          socketChannel.finishConnect();
        }
      }

      if (logger.isInfoEnabled()) {
        logger.info(String.format("Association=%s connected to=%s", association.getName(), socketChannel.getRemoteAddress()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.