Package java.net

Examples of java.net.InetSocketAddress


        String tmp_state_id = hdr.getStateId();
        InputStream bis = null;
        StateTransferInfo sti = null;
        Socket socket = new Socket();
        try {
            socket.bind(new InetSocketAddress(bind_addr, 0));
            int bufferSize = socket.getReceiveBufferSize();
            socket.setReceiveBufferSize(socket_buffer_size);
            if (log.isDebugEnabled())
                log.debug("Connecting to state provider " + address.getIpAddress() + ":"
                        + address.getPort() + ", original buffer size was " + bufferSize
                        + " and was reset to " + socket.getReceiveBufferSize());
           
            Util.connect(socket, new InetSocketAddress(address.getIpAddress(), address.getPort()), 0);
            if (log.isDebugEnabled())
                log.debug("Connected to state provider, my end of the socket is "
                        + socket.getLocalAddress() + ":" + socket.getLocalPort()
                        + " passing inputstream up...");
View Full Code Here


      serverChannel.configureBlocking(false);
    } catch (IOException e) {
      logger.error("Error creating ServerSocketChannel: {}", e);
    }
   
    InetSocketAddress endpoint = new InetSocketAddress(port)// use "any" address
    try {
      serverChannel.socket().bind(endpoint);
    } catch (IOException e) {
      logger.error("Could not bind socket: {}", e);
    }
View Full Code Here

        this.csr = csr;
        this.workContext.setSecurityHelper(csr.getSecurityHelper());
        this.usingEncryption = isClientEncryptionEnabled;
        SocketAddress address = this.objectSocket.getRemoteAddress();
        if (address instanceof InetSocketAddress) {
          InetSocketAddress addr = (InetSocketAddress)address;
          this.workContext.setClientAddress(addr.getAddress().getHostAddress());
          this.workContext.setClientHostname(addr.getHostName());
        }
    }
View Full Code Here

  public void connect(String host, int port, AsyncResult<Boolean> ccb) {
    IOLoop.INSTANCE.updateHandler(channel, interestOps |= SelectionKey.OP_CONNECT);
    connectCallback = ccb;
    if (channel instanceof SocketChannel) {
      try {
        ((SocketChannel) channel).connect(new InetSocketAddress(host, port));
      } catch (IOException e) {
        logger.error("Failed to connect to: {}, message: {} ", host, e.getMessage());
        invokeConnectFailureCallback(e);
      } catch (UnresolvedAddressException e) {
        logger.warn("Unresolvable host: {}", host);
View Full Code Here

        if (outputBufferSize != 0) {
          bootstrap.setOption("sendBufferSize", new Integer(outputBufferSize)); //$NON-NLS-1$
        }
        bootstrap.setOption("keepAlive", Boolean.TRUE); //$NON-NLS-1$
       
        this.serverChanel = bootstrap.bind(new InetSocketAddress(bindAddress, port));
    }
View Full Code Here

        this.info = info;
        this.synchTimeout = synchTimeout;
    }
   
    public synchronized void connect(ObjectChannelFactory channelFactory) throws CommunicationException, IOException {
        this.socketChannel = channelFactory.createObjectChannel(new InetSocketAddress(info.getInetAddress(), info.getPortNumber()), info.isSsl());
        try {
          doHandshake();
        } catch (CommunicationException e) {
          this.socketChannel.close();
          throw e;
View Full Code Here

     */
    public static PlainSocket createPlainSocket(String host, int port, int timeout)
            throws IOException {

        PlainSocket sock = new PlainSocket();
        InetSocketAddress addr = new InetSocketAddress(host, port);
        sock.connect(addr, timeout);
        return sock;
    }
View Full Code Here

     */
    public static PlainSocket createPlainSocket(InetAddress host, int port, int timeout)
            throws IOException {

        PlainSocket sock = new PlainSocket();
        InetSocketAddress addr = new InetSocketAddress(host, port);
        sock.connect(addr, timeout);
        return sock;
    }
View Full Code Here

                ccd.recordRequestStartTime(conn, axis2Req);
                msgContext.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, ccd);
            }

            if (conn == null) {
                ioReactor.connect(new InetSocketAddress(host, port),
                    null, axis2Req, sessionRequestCallback);
                if (log.isDebugEnabled()) {
                    log.debug("A new connection established to : " + host + ":" + port);
                }
            } else {
                try {
                    handler.submitRequest(conn, axis2Req);
                    if (log.isDebugEnabled()) {
                        log.debug("An existing connection reused to : " + host + ":" + port);
                    }                   
                } catch (ConnectionClosedException e) {
                    ioReactor.connect(new InetSocketAddress(host, port),
                        null, axis2Req, sessionRequestCallback);
                    if (log.isDebugEnabled()) {
                        log.debug("A new connection established to : " + host + ":" + port);
                    }
                }
View Full Code Here

    public void addInitialHost(String hostname, int port) {
        //if there is such a stub already, remove and destroy it
        removeInitialHost(hostname, port);
       
        //now re-add it
        InetSocketAddress isa = new InetSocketAddress(hostname, port);
        initial_hosts.add(isa);
        RouterStub s = new RouterStub(isa.getHostName(), isa.getPort(),null,stubManager);       
        connect(s, group_addr, local_addr);
        stubManager.registerStub(s);
    }
View Full Code Here

TOP

Related Classes of java.net.InetSocketAddress

Copyright © 2015 www.massapicom. 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.