Examples of socket()


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

                            if ( cChannel != null )
                            {
                                // little bit tuning
                                cChannel.socket().setTrafficClass( EJConstants.IPTOS_THROUGHPUT );
                                cChannel.socket().setReuseAddress( true );
                                cChannel.socket().setSoLinger( false, 0 );
                               
                                // ensure that the socket channel is prepared
                                // for non-blocking operations
                                cChannel.configureBlocking( false );
                                // create a new ConnectionHeader for all
View Full Code Here

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

                                // for non-blocking operations
                                cChannel.configureBlocking( false );
                                // create a new ConnectionHeader for all
                                // upcoming operations on the
                                // accepted socket connection
                                header = new ConnectionHeader( cChannel, cChannel.socket().getRemoteSocketAddress()
                                        .toString(), true );
                                // register the channel on another thread which
                                // will do further connection handling
                                getProcessor().register( header, SelectionKey.OP_READ );
View Full Code Here

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

                                getProcessor().register( header, SelectionKey.OP_READ );

                                if ( logger.isLoggable( Level.FINE ) )
                                {
                                    logger.log( Level.FINE, "Connection accepted from "
                                            + cChannel.socket().getRemoteSocketAddress() );
                                }
                            }
                        }
                    }
                    catch ( CancelledKeyException cke )
View Full Code Here

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

        try
        {
            nonBlockingRead( channel, headerBuf );
            headerBuf.flip();
            read = headerBuf.getInt();
            IOUtil.setReceiveBufferSize( channel.socket(), read );
        }
        catch ( IncompleteIOException ioe )
        {
            logger.log( Level.FINEST, "Incomplete header read detected, registering for read again." );
            // ioe.setIOBuffer(null);
View Full Code Here

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

        headerBuf.putInt( length );
        headerBuf.flip();
        try
        {
            nonBlockingWrite( channel, headerBuf );
            IOUtil.setSendBufferSize( channel.socket(), length );
        }
        catch ( IncompleteIOException ioe )
        {
            logger.log( Level.FINEST, "Incomplete header write detected, registering for write again." );
            // ioe.setIOBuffer(null);
View Full Code Here

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

        }

        try
        {
            semiBlockingWrite( channel, headerBuf, timeout );
            IOUtil.setSendBufferSize( channel.socket(), length );
        }
        catch ( IncompleteIOException ioe )
        {
            logger.log( Level.FINEST, "Incomplete header write detected, skip this request." );
            throw new IncompleteIOException( null, SelectionKey.OP_WRITE );
View Full Code Here

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

               
                // What kind of activity is it?
                if ((key.readyOps() & SelectionKey.OP_READ) == SelectionKey.OP_READ)
                {
                    SocketChannel ch = (SocketChannel)key.channel();
                    java.net.Socket ss = (java.net.Socket)ch.socket();
                    Socket s = (Socket)key.attachment();
                    if (s != null)
                    {
//                        System.out.println(s + ": OnRead");
                        s.OnRead();
View Full Code Here

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

                    }
                }
                if ((key.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE)
                {
                    SocketChannel ch = (SocketChannel)key.channel();
                    java.net.Socket ss = (java.net.Socket)ch.socket();
                    Socket s = (Socket)key.attachment();
                    if (s != null)
                    {
//                        System.out.println(s + ": OnWrite");
                        s.OnWrite();
View Full Code Here

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

                    }
                }
                if ((key.readyOps() & SelectionKey.OP_ACCEPT) == SelectionKey.OP_ACCEPT)
                {
                    ServerSocketChannel ch = (ServerSocketChannel)key.channel();
                    java.net.ServerSocket ss = (java.net.ServerSocket)ch.socket();
                    Socket s = (Socket)key.attachment();
                    if (s != null)
                    {
//                        System.out.println(s + ": OnRead(ACCEPT)");
                        s.OnRead(); // ListenSocket.OnRead will call OnAccept on new Socket
View Full Code Here

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

                    }
                }
                if ((key.readyOps() & SelectionKey.OP_CONNECT) == SelectionKey.OP_CONNECT)
                {
                    SocketChannel ch = (SocketChannel)key.channel();
                    java.net.Socket ss = (java.net.Socket)ch.socket();
                    Socket s = (Socket)key.attachment();
                    if (s != null)
                    {
//                        System.out.println(s + ": OnConnect");
                        ch.finishConnect();
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.