Examples of finishConnect()


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

            public boolean
            selectSuccess(
              VirtualChannelSelector selector, SocketChannel sc, Object attachment)
            {
              try{
                if ( channel.finishConnect()){
                 
                  outgoing( channel );
                 
                  return( true );
                }else{
View Full Code Here

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

    SocketAddress address = new InetSocketAddress("localhost",port);
    SocketChannel channel = SocketChannel.open();
    channel.configureBlocking(false);
    if (! channel.connect(address)) {
      // we're willing to wait for about a second.
      for (int i = 0; (! channel.finishConnect()) && i < 4; i++) {
  try {
    getLogger().log(Level.FINE, "not connected; sleeping (" + i + ").");
    Thread.currentThread().sleep(250);
  } catch (Exception e) {
  }
View Full Code Here

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

                    java.net.Socket ss = (java.net.Socket)ch.socket();
                    Socket s = (Socket)key.attachment();
                    if (s != null)
                    {
//                        System.out.println(s + ": OnConnect");
                        ch.finishConnect();
                        s.SetConnecting(false);
                        s.GetKey().interestOps(SelectionKey.OP_READ);
                        s.OnConnect();
                    }
                }
View Full Code Here

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

                channel = SocketChannel.open();
                Socket socket = channel.socket();
                socket.bind(new InetSocketAddress(InetAddress.getByName(localHost), localPort));
                socket.connect(new InetSocketAddress(InetAddress.getByName(remoteHost), remotePort));
            }
            channel.finishConnect();
            initSocket(context.getRuntime(), new ChannelDescriptor(channel, RubyIO.getNewFileno(), new ModeFlags(ModeFlags.RDWR), new FileDescriptor()));
        } catch (InvalidValueException ex) {
            throw context.getRuntime().newErrnoEINVALError();
        } catch(ConnectException e) {
            throw context.getRuntime().newErrnoECONNREFUSEDError();
View Full Code Here

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

                    // 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

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

   * process a connect complete selection
   */
  public void doConnect() {
    SocketChannel sc = (SocketChannel) sk.channel();
    try {
      sc.finishConnect();
      sk.interestOps(sk.interestOps() & ~SelectionKey.OP_CONNECT);
      log.fine("connect complete");
      state = Connection.OPEN;
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

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

            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

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

                    // Why we just have to do this once, here
                    now = System.currentTimeMillis();
                    for (SelectionKey k : selected) {
                        SocketChannel sc = ((SocketChannel) k.channel());
                        if ((k.readyOps() & SelectionKey.OP_CONNECT) != 0) {
                            if (sc.finishConnect()) {
                                lastHeard = now;
                                lastSend = now;
                                primeConnection(k);
                                LOG.info("Server connection successful");
                            }
View Full Code Here

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

                    // Why we just have to do this once, here
                    now = System.currentTimeMillis();
                    for (SelectionKey k : selected) {
                        SocketChannel sc = ((SocketChannel) k.channel());
                        if ((k.readyOps() & SelectionKey.OP_CONNECT) != 0) {
                            if (sc.finishConnect()) {
                                lastHeard = now;
                                lastSend = now;
                                primeConnection(k);
                                LOG.info("Server connection successful");
                            }
View Full Code Here

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

                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
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.