Code example for InetSocketAddress

Methods: isUnresolved

0
 
  public TcpClient(String host, int port, RemoteClient parent) throws IOException, IllegalArgumentException {
    ui = parent;
    // Open connection : 
    sock = new Socket();
    InetSocketAddress adress = new InetSocketAddress(host, port);
    if (adress.isUnresolved()) {
      Log.d(LOGTAG, "Adress is unresolved");
      throw new IllegalArgumentException("Bad adress");
    } 
 
    sock.connect(adress, 1000);
    sender = new Sender(sock);
    receiver = new Receiver(sock);
    serverPort = port;
    serverUrl = host;
  } 
 
  public int getPort() { 
    return serverPort;
  }