Package java.nio.channels

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


        socket.setReceiveBufferSize(getSocketReceiveBufferSize());
        socket.setReuseAddress(isSocketReuseAddress());
        socket.setSoTimeout(getMaxIoIdleTimeMs());
        socket.bind(createSocketAddress());

        result.configureBlocking(false);
        return result;
    }

    /**
     * Creates a socket address to listen on.
View Full Code Here


     * Simple socket to have something to ping.
     */
    protected void setupDummyServer() throws Exception
    {
        ServerSocketChannel ssChannel = ServerSocketChannel.open();
        ssChannel.configureBlocking(false);
        serverSocket = ssChannel.socket();

        serverSocket.bind(new InetSocketAddress(port));
    }

View Full Code Here

        try {
            HttpMediator mediator = new HttpMediator(reactor, intercept);

            /* Create the channel and bind it in */
            ServerSocketChannel ch = ServerSocketChannel.open();
            ch.configureBlocking(false);
           
            /* Bind away */
            ch.socket().bind(new InetSocketAddress(port), backlog);
           
            reactor.attach(ch, new HttpServerHandler(mediator));
View Full Code Here

            ServerSocketChannel ssc = null;

            try
            {
                ssc = ServerSocketChannel.open();
                ssc.configureBlocking( false );

                // Configure the server socket,
                SocketAcceptorConfig cfg;
                if( req.config instanceof SocketAcceptorConfig )
                {
View Full Code Here

            ServerSocketChannel ssc = null;

            try {
                ssc = ServerSocketChannel.open();
                ssc.configureBlocking(false);

                // Configure the server socket,
                SocketAcceptorConfig cfg;
                if (req.config instanceof SocketAcceptorConfig) {
                    cfg = (SocketAcceptorConfig) req.config;
View Full Code Here

                        {
                            SocketChannel channel = acceptChannel(key);
                            if (channel==null)
                                continue;

                            channel.configureBlocking(false);

                            // TODO make it reluctant to leave 0
                            _nextSet=++_nextSet%_selectSet.length;

                            // Is this for this selectset
View Full Code Here

   * @param secure
   */
  public void listen(int port, NetSelectionCallback callback, boolean secure)
    throws IOException {
    ServerSocketChannel ssc = ServerSocketChannel.open();
    ssc.configureBlocking(false);
    ssc.socket().setReuseAddress(true);
    port = verboseBind(ssc, port);
    ssc.register(selector_, SelectionKey.OP_ACCEPT, callback);
    server_channels_.add(ssc);
    if (secure) {
View Full Code Here

    public ServerSocket serverSocketCreate(short port) {
        try {
            // Create non-blocking server sockets on port.
            ServerSocketChannel serverSocketChannel = ServerSocketChannel
                    .open();
            serverSocketChannel.configureBlocking(false);

            ServerSocket serverSocket = serverSocketChannel.socket();
                serverSocket.setReuseAddress(true);
            serverSocket.bind(new InetSocketAddress(
                    InetAddress.getByName(null), port));
View Full Code Here

            ServerSocketChannel ssc = null;

            try
            {
                ssc = ServerSocketChannel.open();
                ssc.configureBlocking( false );
                ssc.socket().bind( req.address, req.backlog );
                ssc.register( selector, SelectionKey.OP_ACCEPT, req );

                channels.put( req.address, ssc );
            }
View Full Code Here

    }

    public SocketAddress listen(
            final SocketAddress address) throws IOException {
        ServerSocketChannel serverChannel = ServerSocketChannel.open();
        serverChannel.configureBlocking(false);
        serverChannel.socket().bind(address);
        SelectionKey key = serverChannel.register(this.selector, SelectionKey.OP_ACCEPT);
        key.attach(null);
        return serverChannel.socket().getLocalSocketAddress();
    }
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.