public class SocketOutputStream extends java.lang.Object implements OutputDataStream
Constructor and Description |
---|
SocketOutputStream(java.net.DatagramSocket sckt)
Creates a new SocketOutputStream
|
Modifier and Type | Method and Description |
---|---|
void |
addTarget(java.net.InetAddress remoteAddr,
int remotePort)
Add a target to stream targets list
|
boolean |
removeTarget(java.net.InetAddress remoteAddr,
int remotePort)
Remove a target from stream targets list
|
void |
removeTargets()
Remove all stream targets from this session.
|
int |
write(byte[] buffer,
int offset,
int length)
Write a data buffer to all known remote targets.
|
int |
writeToRemote(byte[] buffer,
int offset,
int length,
java.net.InetAddress remoteAddr,
int remotePort)
Write a data buffer to one specific remote target.
|
public SocketOutputStream(java.net.DatagramSocket sckt)
socket
- The datagram socket to adaptsendAddress
- The address to send packets tosendPort
- The port to send packets topublic void addTarget(java.net.InetAddress remoteAddr, int remotePort)
remoteAddr
- target ip addressremotePort
- target portpublic boolean removeTarget(java.net.InetAddress remoteAddr, int remotePort)
remoteAddr
- target ip addressremotePort
- target portpublic void removeTargets()
public int write(byte[] buffer, int offset, int length)
write
in interface OutputDataStream
buffer
- The byte array containing the dataoffset
- Offset into the byte array to get data fromlength
- Length in bytes of the data to send.public int writeToRemote(byte[] buffer, int offset, int length, java.net.InetAddress remoteAddr, int remotePort)
buffer
- The byte array containing the dataoffset
- Offset into the byte array to get data fromlength
- Length in bytes of the data to sendremoteAddr
- The remote IP address of the targetremotePort
- The port number of the target