Package java.net

Examples of java.net.InetSocketAddress


     
      throw( new TRTrackerServerException( "port of 0 not currently supported"));
    }
   
    try{
      InetSocketAddress  address;
     
      if ( _bind_ip == null ){
       
        _bind_ip = NetworkAdmin.getSingleton().getSingleHomedServiceBindAddress();
   
        if ( _bind_ip == null ){
         
          address = new InetSocketAddress( _port );
         
        }else{
 
          current_bind_ip = _bind_ip;
         
          address = new InetSocketAddress( _bind_ip, _port );     
        }
      }else{
       
        current_bind_ip = _bind_ip;

        address = new InetSocketAddress_bind_ip, _port )
      }
     
      accept_server = VirtualServerChannelSelectorFactory.createBlocking( address, 0, this );
     
      accept_server.start();
View Full Code Here


             
              return( true );
            }
          });
     
      InetSocketAddress  tcp_target = new InetSocketAddress( "127.0.0.1",     6889 );
      InetSocketAddress  udp_target = new InetSocketAddress( "212.159.18.92",   6881 );
     
      GenericMessageEndpoint  endpoint = reg.createEndpoint( tcp_target );
     
      endpoint.addTCP( tcp_target );
      endpoint.addUDP( udp_target );
View Full Code Here

   
    while( true ) {
      try {
        Socket socket = serverSocket.accept();
       
        InetSocketAddress addr = (InetSocketAddress) socket.getRemoteSocketAddress();
       
        if( addr.isUnresolved() || ! isAllowed(addr) ) {
          System.out.println("TelnetUI: rejecting connection from: " + addr + " as address is not allowed");
          socket.close();
        }
        else {
          System.out.println("TelnetUI: accepting connection from: " + addr);
View Full Code Here

    diskManager =manager.getDiskManager();
    piecePicker =manager.getPiecePicker();
    nbPieces =diskManager.getNbPieces();


    InetSocketAddress notional_address = _connection.getEndpoint().getNotionalAddress();

    ip    = notional_address.getAddress().getHostAddress();
    port  = notional_address.getPort();
   
    peer_item_identity = PeerItemFactory.createPeerItem( ip, port, PeerItem.convertSourceID( _peer_source ), PeerItemFactory.HANDSHAKE_TYPE_PLAIN, 0, PeerItemFactory.CRYPTO_LEVEL_1, 0 )//this will be recreated upon az handshake decode

    plugin_connection = new ConnectionImpl(connection, incoming);
View Full Code Here

        _require_crypto_handshake ||
          NetworkManager.getCryptoRequired( manager.getAdapter().getCryptoLevel());

    if( isLANLocal() )  use_crypto = false//dont bother with PHE for lan peers

    InetSocketAddress  endpoint_address;
    ProtocolEndpoint  pe;

    if ( _use_tcp ){

      endpoint_address = new InetSocketAddress( ip, tcp_listen_port );

      pe = ProtocolEndpointFactory.createEndpoint( ProtocolEndpoint.PROTOCOL_TCP, endpoint_address );

    }else{

      endpoint_address = new InetSocketAddress( ip, udp_listen_port );

      pe = ProtocolEndpointFactory.createEndpoint( ProtocolEndpoint.PROTOCOL_UDP, endpoint_address );
    }

    ConnectionEndpoint connection_endpoint  = new ConnectionEndpoint( endpoint_address );
View Full Code Here

        it.remove();

        PeerNATTraverser.getSingleton().create(
            this,
            new InetSocketAddress( peer.getPeerItemIdentity().getAddressString(), peer.getPeerItemIdentity().getUDPPort() ),
            new PeerNATTraversalAdapter()
            {
              private boolean  done;

              public void
View Full Code Here

   
    Iterator it = traversals.iterator();
   
    while( it.hasNext()){
     
      InetSocketAddress ad = (InetSocketAddress)it.next();
     
      active_udp += (active_udp.length()==0?"":",") + ad.getAddress().getHostAddress() + ":" + ad.getPort();
    }
   
    if ( active_udp.length() > 0 ){
     
      writer.println( "    active_udp=" + active_udp );
View Full Code Here

      long endTime;
      synchronized (updateLock) {
        tcpRegistered = false;
        selector.wakeup();
        endTime = System.currentTimeMillis() + timeout;
        tcp.connect(selector, new InetSocketAddress(host, tcpPort), 5000);
      }

      // Wait for RegisterTCP.
      synchronized (tcpRegistrationLock) {
        while (!tcpRegistered && System.currentTimeMillis() < endTime) {
          try {
            tcpRegistrationLock.wait(100);
          } catch (InterruptedException ignored) {
          }
        }
        if (!tcpRegistered) {
          throw new SocketTimeoutException("Connected, but timed out during TCP registration.\n"
            + "Note: Client#update must be called in a separate thread during connect.");
        }
      }

      if (udpPort != -1) {
        InetSocketAddress udpAddress = new InetSocketAddress(host, udpPort);
        synchronized (updateLock) {
          udpRegistered = false;
          selector.wakeup();
          udp.connect(selector, udpAddress);
        }
View Full Code Here

    if (INFO) {
      SocketChannel socketChannel = tcp.socketChannel;
      if (socketChannel != null) {
        Socket socket = tcp.socketChannel.socket();
        if (socket != null) {
          InetSocketAddress remoteSocketAddress = (InetSocketAddress)socket.getRemoteSocketAddress();
          if (remoteSocketAddress != null) info("kryonet", this + " connected: " + remoteSocketAddress.getAddress());
        }
      }
    }
    Listener[] listeners = this.listeners;
    for (int i = 0, n = listeners.length; i < n; i++)
View Full Code Here

  /**
   * Returns the IP address and port of the remote end of the UDP connection, or null if this connection is not connected.
   */
  public InetSocketAddress getRemoteAddressUDP () {
    InetSocketAddress connectedAddress = udp.connectedAddress;
    if (connectedAddress != null) return connectedAddress;
    return udpRemoteAddress;
  }
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.