Examples of SocketAddress


Examples of java.net.SocketAddress

    private void readHandle(H handle) throws Exception {
        IoBuffer readBuf = IoBuffer.allocate(
                getSessionConfig().getReadBufferSize());

        SocketAddress remoteAddress = receive(handle, readBuf);
       
        if (remoteAddress != null) {
            IoSession session = newSessionWithoutLock(
                    remoteAddress, localAddress(handle));
View Full Code Here

Examples of java.net.SocketAddress

                    buf.reset();
                    session.getFilterChain().fireMessageSent(req);
                    continue;
                }

                SocketAddress destination = req.getDestination();
               
                if (destination == null) {
                    destination = session.getRemoteAddress();
                }
View Full Code Here

Examples of java.net.SocketAddress

     */
    @Override
    public String toString() {
        if (isConnected()||isClosing()) {
            try {
                SocketAddress remote = getRemoteAddress();
                SocketAddress local = getLocalAddress();
               
                if (getService() instanceof IoAcceptor) {
                    return "(" + getIdAsString() + ": " + getServiceName() + ", server, " +
                            remote + " => " + local + ')';
                }
View Full Code Here

Examples of java.net.SocketAddress

                                    if (length > remaining) {
                                        length -= remaining;
                                        buffer.skipBytes(remaining);
                                    } else {
                                        buffer.skipBytes(length);
                                        SocketAddress remoteAddress = e.getRemoteAddress();
                                        ctx.getChannel().write(ACK.slice(), remoteAddress);
                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
                                        length = 0;
                                    }
                                }
View Full Code Here

Examples of java.net.SocketAddress

                    session.write(message);
                }
            }
        });
        try {
            final SocketAddress address = new InetSocketAddress(9999);
            acceptor.bind(address);
            LOG.debug("Running the server for 25 sec");
            Thread.sleep(25000);
            LOG.debug("Unbinding the TCP port");
            acceptor.unbind();
View Full Code Here

Examples of java.net.SocketAddress

    public void ready(final boolean accept, boolean connect, final boolean read, final ByteBuffer readBuffer,
            final boolean write) {
        // Process the reads first
        try {
            // System.err.println("remaining : " + readBuffer.remaining());
            final SocketAddress source = datagramChannel.receive(readBuffer);
            NioUdpSession session = null;

            // let's find the corresponding session
            if (source != null) {
                session = sessions.get(source);
View Full Code Here

Examples of java.net.SocketAddress

    private NioUdpSession createSession(SocketAddress remoteAddress, DatagramChannel datagramChannel)
            throws IOException {
        LOG.debug("create session");
        UdpSessionConfig config = getSessionConfig();
        SocketAddress localAddress = new InetSocketAddress(datagramChannel.socket().getLocalAddress(), datagramChannel
                .socket().getLocalPort());
        final NioUdpSession session = new NioUdpSession(this, idleChecker, datagramChannel, localAddress, remoteAddress);

        // apply idle configuration
        session.getConfig().setIdleTimeInMillis(IdleStatus.READ_IDLE, config.getIdleTimeInMillis(IdleStatus.READ_IDLE));
View Full Code Here

Examples of java.net.SocketAddress

            ByteBuffer rcvdBuffer = ByteBuffer.allocate(64 * 1024);
            while (bound) {
                // I/O !
                rcvdBuffer.clear();
                try {
                    SocketAddress from = channel.receive(rcvdBuffer);
                    BioUdpSession session = sessions.get(from);
                    if (session == null) {
                        // create the session
                        session = new BioUdpSession(from, BioUdpServer.this, idleChecker);
                        sessions.put(from, session);
View Full Code Here

Examples of java.net.SocketAddress

                    s.setReceiveBufferSize(64 * 1024);
                    s.setSoTimeout(5000);
                    byte[] bytes = new byte[64 * 1024];
                    DatagramPacket p = new DatagramPacket(bytes, bytes.length, address, Integer.parseInt(PORT));
                    s.receive(p);
                    SocketAddress sa = p.getSocketAddress();
                    String incoming = new String(p.getData(), 0, p.getLength(), "UTF-8");
                    int idx = incoming.indexOf("MessageID");
                    idx = incoming.indexOf('>', idx);
                    incoming = incoming.substring(idx + 1);
                    idx = incoming.indexOf("</");
View Full Code Here

Examples of java.net.SocketAddress

            // Inject the protocolHandler
            connector.setHandler( this );
        }

        // Build the connection address
        SocketAddress address = new InetSocketAddress( config.getLdapHost(), config.getLdapPort() );

        // And create the connection future
        ConnectFuture connectionFuture = connector.connect( address );

        // Wait until it's established
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.