Package java.net

Examples of java.net.InetSocketAddress$InetSocketAddressHolder


   */
  public Socket createSocket(InetAddress addr, int port,
                             InetAddress localAddr, int localPort,
                             int timeout) throws IOException {
    Socket socket = new Socket();
    InetSocketAddress endpoint = new InetSocketAddress(addr, port);
    InetSocketAddress bindpoint = new InetSocketAddress(localAddr, localPort);
    socket.bind(bindpoint);
    socket.connect(endpoint, timeout);

    return socket;
  }
View Full Code Here


  static SocketListener jdbcTransport;
 
  @BeforeClass public static void oneTimeSetup() throws Exception {
    SocketConfiguration config = new SocketConfiguration();
    config.setSSLConfiguration(new SSLConfiguration());
    addr = new InetSocketAddress(0);
    config.setBindAddress(addr.getHostName());
    config.setPortNumber(0);
   
    FakeServer server = new FakeServer();
    server.setUseCallingThread(false);
View Full Code Here

            // set different state variables
            passive = true;
            requestTime = System.currentTimeMillis();

            return new InetSocketAddress(address, port);
        } catch (Exception ex) {
            servSoc = null;
            closeDataConnection();
            throw new DataConnectionException(
                    "Failed to initate passive data connection: "
View Full Code Here

                // if no local address has been configured, make sure we use the same as the client connects from
                if(localAddr == null) {
                    localAddr = ((InetSocketAddress)session.getLocalAddress()).getAddress();
                }      

                SocketAddress localSocketAddress = new InetSocketAddress(localAddr, dataConfig.getActiveLocalPort());
               
                LOG.debug("Binding active data connection to {}", localSocketAddress);
                dataSoc.bind(localSocketAddress);

                dataSoc.connect(new InetSocketAddress(address, port));
            } else {

                if (secure) {
                    LOG.debug("Opening secure passive data connection");
                    // this is where we wrap the unsecured socket as a SSLSocket. This is
View Full Code Here

    if ( closed ){
     
      throw( new MessageException( "Connection has been closed" ));
    }
   
    InetSocketAddress  tcp_ep = endpoint.getTCP();
       
    if ( tcp_ep != null ){
     
      connectTCP( initial_data, tcp_ep );
     
    }else{
     
      InetSocketAddress  udp_ep = endpoint.getUDP();

      if ( udp_ep != null ){
       
        connectUDP( initial_data, udp_ep, false );
       
View Full Code Here

         
          public void
          connectFailure(
            Throwable failure_msg )
          {
            InetSocketAddress  udp_ep = endpoint.getUDP();

            if ( udp_ep != null && !connected ){
             
              initial_data.rewind();
             
View Full Code Here

    if ( instance_manager == null || !instance_manager.isInitialized()){
     
      return( address );
    }
   
    InetSocketAddress  adjusted_address;
   
    if ( ext_to_lan ){
     
      adjusted_address  = instance_manager.getLANAddress( address, port_type );
     
View Full Code Here

        // set data connection
        ServerDataConnectionFactory dataCon = session.getDataConnection();

        try {
            InetSocketAddress dataConAddress = dataCon
                    .initPassiveDataConnection();
            // get connection info
            int servPort = dataConAddress.getPort();

            // send connection info to client
            String portStr = "|||" + servPort + '|';
            session.write(LocalizedFtpReply.translate(session, request, context,
                    229, "EPSV", portStr));
View Full Code Here

   
            acceptor = new NioSocketAcceptor(Runtime.getRuntime()
                    .availableProcessors());
   
            if (getServerAddress() != null) {
                address = new InetSocketAddress(getServerAddress(), getPort());
            } else {
                address = new InetSocketAddress(getPort());
            }
   
            acceptor.setReuseAddress(true);
            acceptor.getSessionConfig().setReadBufferSize(2048);
            acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
View Full Code Here

        ServerDataConnectionFactory dataCon = session.getDataConnection();
        String externalPassiveAddress = getPassiveExternalAddress(session);

        try {

            InetSocketAddress dataConAddress = dataCon.initPassiveDataConnection();

            // get connection info
            InetAddress servAddr;
            if (externalPassiveAddress != null) {
                servAddr = resolveAddress(externalPassiveAddress);
            } else {
                servAddr = dataConAddress.getAddress();
            }

            // send connection info to client
            InetSocketAddress externalDataConAddress = new InetSocketAddress(
                servAddr, dataConAddress.getPort());

            String addrStr = SocketAddressEncoder.encode(externalDataConAddress);
            session.write(LocalizedFtpReply.translate(session, request, context,
                FtpReply.REPLY_227_ENTERING_PASSIVE_MODE, "PASV", addrStr));
View Full Code Here

TOP

Related Classes of java.net.InetSocketAddress$InetSocketAddressHolder

Copyright © 2018 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.