local.net
Class KeepAliveUdp

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--local.net.KeepAliveUdp
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
KeepAliveSip

public class KeepAliveUdp
extends java.lang.Thread

KeepAliveUdp thread, for keeping the connection up toward a target node (e.g. toward the seriving proxy/gw or a remote UA). It periodically sends keep-alive tokens in order to refresh NAT UDP session timeouts.

It can be used for both signaling (SIP) or data plane (RTP/UDP).


Field Summary
protected  long delta_time
          Time between two keep-alive tokens [millisecs]
protected  org.zoolu.net.SocketAddress target
          Destination socket address (e.g. the registrar server)
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected KeepAliveUdp(org.zoolu.net.SocketAddress target, long delta_time)
          Creates a new KeepAliveUdp daemon
  KeepAliveUdp(org.zoolu.net.UdpSocket udp_socket, org.zoolu.net.SocketAddress target, long delta_time)
          Creates a new KeepAliveUdp daemon
  KeepAliveUdp(org.zoolu.net.UdpSocket udp_socket, org.zoolu.net.SocketAddress target, org.zoolu.net.UdpPacket udp_packet, long delta_time)
          Creates a new KeepAliveUdp daemon
 
Method Summary
 long getDeltaTime()
          Gets the time (in milliseconds) between two keep-alive tokens
 org.zoolu.net.SocketAddress getDestSoAddress()
          Gets the destination SocketAddress
 void halt()
          Stops sending keep-alive tokens
 boolean isRunning()
          Whether the UDP relay is running
 void run()
          Main thread.
 void sendToken()
          Sends the kepp-alive packet now.
 void setDeltaTime(long delta_time)
          Sets the time (in milliseconds) between two keep-alive tokens
 void setDestSoAddress(org.zoolu.net.SocketAddress soaddr)
          Sets the destination SocketAddress
 void setExpirationTime(long time)
          Sets the expiration time (in milliseconds)
 java.lang.String toString()
          Gets a String representation of the Object
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

target

protected org.zoolu.net.SocketAddress target
Destination socket address (e.g. the registrar server)

delta_time

protected long delta_time
Time between two keep-alive tokens [millisecs]
Constructor Detail

KeepAliveUdp

protected KeepAliveUdp(org.zoolu.net.SocketAddress target,
                       long delta_time)
Creates a new KeepAliveUdp daemon

KeepAliveUdp

public KeepAliveUdp(org.zoolu.net.UdpSocket udp_socket,
                    org.zoolu.net.SocketAddress target,
                    long delta_time)
Creates a new KeepAliveUdp daemon

KeepAliveUdp

public KeepAliveUdp(org.zoolu.net.UdpSocket udp_socket,
                    org.zoolu.net.SocketAddress target,
                    org.zoolu.net.UdpPacket udp_packet,
                    long delta_time)
Creates a new KeepAliveUdp daemon
Method Detail

isRunning

public boolean isRunning()
Whether the UDP relay is running

setDeltaTime

public void setDeltaTime(long delta_time)
Sets the time (in milliseconds) between two keep-alive tokens

getDeltaTime

public long getDeltaTime()
Gets the time (in milliseconds) between two keep-alive tokens

setDestSoAddress

public void setDestSoAddress(org.zoolu.net.SocketAddress soaddr)
Sets the destination SocketAddress

getDestSoAddress

public org.zoolu.net.SocketAddress getDestSoAddress()
Gets the destination SocketAddress

setExpirationTime

public void setExpirationTime(long time)
Sets the expiration time (in milliseconds)

halt

public void halt()
Stops sending keep-alive tokens

sendToken

public void sendToken()
               throws java.io.IOException
Sends the kepp-alive packet now.

run

public void run()
Main thread.
Overrides:
run in class java.lang.Thread

toString

public java.lang.String toString()
Gets a String representation of the Object
Overrides:
toString in class java.lang.Thread