Examples of configureBlocking()


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

    ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key
        .channel();

    // Accept the connection and make it non-blocking
    SocketChannel socketChannel = serverSocketChannel.accept();
    socketChannel.configureBlocking(false);

    // Register new SocketChannel with our Selector, indicating
    // we'd like to be notified when there's data waiting to be read
    socketChannel.register(this.selector, SelectionKey.OP_READ);
  }
View Full Code Here

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

      Connection c;
      ServerSocketChannel server = (ServerSocketChannel) key.channel();

      SocketChannel channel;
      while ((channel = server.accept()) != null) {
        channel.configureBlocking(false);
        channel.socket().setTcpNoDelay(tcpNoDelay);
        channel.socket().setKeepAlive(tcpKeepAlive);

        Reader reader = getReader();
        try {
View Full Code Here

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

    public <C> Connector<C> createConnector(String host, int port, C context)
    {
        try
        {
            SocketChannel channel = SocketChannel.open();
            channel.configureBlocking(false);
            channel.connect(new InetSocketAddress(host, port));
            return createConnector(channel, context);
        }
        catch (IOException e)
        {
View Full Code Here

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

        try
        {
            SocketChannel c = _channel.accept();
            if(c != null)
            {
                c.configureBlocking(false);
                return _driver.createServerConnector(c, _context, this);
            }
        }
        catch (IOException e)
        {
View Full Code Here

Examples of jnr.enxio.channels.NativeServerSocketChannel.configureBlocking()

        short baseport = 2000;
        try {
            Selector selector = NativeSelectorProvider.getInstance().openSelector();
            for (int i = 0; i < 2; ++i) {
                NativeServerSocketChannel ch = serverSocket(baseport + i);
                ch.configureBlocking(false);
                ch.register(selector, SelectionKey.OP_ACCEPT, new Accepter(selector, ch));
            }
            while (true) {
                selector.select();
                for (SelectionKey k : selector.selectedKeys()) {
View Full Code Here

Examples of jnr.enxio.channels.NativeSocketChannel.configureBlocking()

            int[] addrSize = { Struct.size(sin) };
            int clientfd = libc.accept(((NativeSelectableChannel) channel).getFD(), sin, addrSize);
            System.out.println("client fd = " + clientfd);
            NativeSocketChannel ch = new NativeSocketChannel(clientfd);
            try {
                ch.configureBlocking(false);
                ch.register(selector, SelectionKey.OP_READ, new Client(selector, ch));
                selector.wakeup();
            } catch (IOException ex) {}
        }
        public void write() {
View Full Code Here

Examples of jnr.unixsocket.UnixServerSocketChannel.configureBlocking()

        UnixSocketAddress address = new UnixSocketAddress(path);
        UnixServerSocketChannel channel = UnixServerSocketChannel.open();

        try {
            Selector sel = NativeSelectorProvider.getInstance().openSelector();
            channel.configureBlocking(false);
            channel.socket().bind(address);
            channel.register(sel, SelectionKey.OP_ACCEPT, new ServerActor(channel, sel));

            while (sel.select() > 0) {
                Set<SelectionKey> keys = sel.selectedKeys();
View Full Code Here

Examples of jnr.unixsocket.UnixSocketChannel.configureBlocking()

            this.selector = selector;
        }
        public final boolean rxready() {
            try {
                UnixSocketChannel client = channel.accept();
                client.configureBlocking(false);
                client.register(selector, SelectionKey.OP_READ, new ClientActor(client));
                return true;
            } catch (IOException ex) {
                return false;
            }
View Full Code Here

Examples of kg.apc.emulators.DatagramChannelEmul.configureBlocking()

        protected DatagramChannelWithTimeoutsEmul() throws IOException {
            super();
            selector = new SelectorEmul();
            DatagramChannelEmul ce = (DatagramChannelEmul) DatagramChannelEmul.open();
            ce.configureBlocking(false);
            ce.setBytesToRead(ByteBuffer.wrap("test".getBytes()));
            channel = ce;
            channelKey = channel.register(selector, SelectionKey.OP_READ);
        }
    }
View Full Code Here

Examples of kg.apc.emulators.SocketChannelEmul.configureBlocking()

        protected SocketChannelWithTimeoutsEmul() throws IOException {
            super();
            selector = new SelectorEmul();
            SocketChannelEmul ce = new SocketChannelEmul();
            ce.configureBlocking(false);
            ce.setBytesToRead(ByteBuffer.wrap("test".getBytes()));
            socketChannel = ce;
            channelKey=new SelectionKeyEmul();
        }
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.