Modifier and Type | Field and Description |
---|---|
protected InetAddress |
remoteHost |
protected int |
remotePort |
protected DatagramSocket |
sock |
Constructor and Description |
---|
UDPSink(DatagramSocket socket,
InetAddress host,
int port) |
UDPSink(InetAddress host,
int port) |
Modifier and Type | Method and Description |
---|---|
int |
getPort() |
DatagramSocket |
getSocket()
to pass to UDPSource constructor
|
void |
send(Destination src,
int fromPort,
int toPort,
byte[] data) |
void |
stop() |
protected final DatagramSocket sock
protected final InetAddress remoteHost
protected final int remotePort
public UDPSink(InetAddress host, int port)
host
- where to sendport
- where to sendIllegalArgumentException
- on DatagramSocket IOExceptionpublic UDPSink(DatagramSocket socket, InetAddress host, int port)
socket
- existing sockethost
- where to sendport
- where to sendpublic void send(Destination src, int fromPort, int toPort, byte[] data)
send
in interface Sink
src
- ignoredfromPort
- ignoredtoPort
- ignoredRuntimeException
- on DatagramSocket IOExceptionpublic int getPort()
public DatagramSocket getSocket()
public void stop()