Code example for DatagramSocket

Methods: setSoTimeout

0
    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);
 
  public void send(RtpPacket outPacket) throws IOException {
    long start = SystemClock.uptimeMillis();
    try { 
      socket.send(new DatagramPacket(outPacket.getPacket(), outPacket.getPacketLength()));
    } catch (IOException e) {
      if (!socket.isClosed()) {
        throw new IOException(e);