Code example for InetSocketAddress

Methods: getAddressgetPort

0
  private DatagramSocket socket;
 
  public RtpSocket(int localPort, InetSocketAddress remoteAddress) throws SocketException {
    socket = new DatagramSocket(localPort);
    socket.setSoTimeout(1);
    socket.connect(new InetSocketAddress(remoteAddress.getAddress().getHostAddress(), remoteAddress.getPort()));
    Log.d( "RtpSocket", "Connected to: " + remoteAddress.getAddress().getHostAddress() );
  } 
 
  public void setTimeout(int timeoutMillis) {
    try { 
      socket.setSoTimeout(timeoutMillis);
    } catch (SocketException e) {
      Log.w("RtpSocket", e);
    } 
  } 
 
  private long totalSendTime = 0;
  private PeriodicTimer pt = new PeriodicTimer(10000);
 
Connect your IDE to all the code out there  Get Codota for Java