| Modifier and Type | Field and Description |
|---|---|
boolean |
allowJumboPackets
If true, allow sending of "jumbo packets" (fragmented packets) larger than
the MTU of the interface.
|
static Lazy<Transport> |
DEFAULT
The default UDP broadcast.
|
int |
mtu
The inferred MTU (Maximum Transmission Unit) of this transport
|
java.net.InetAddress |
serverName
The name we should assign ourselves on the transport.
|
boolean |
thread
If true, run the handling of messages on the transport in a new thread.
|
boolean |
zip
If true, zip packets on the network.
|
| Constructor and Description |
|---|
UDPTransport() |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(UDPBroadcastProtos.MessageType channel,
java.util.function.Consumer<byte[]> listener)
Bind a consumer to this transport, to listen on incoming messages.
|
boolean |
broadcastTransport(UDPBroadcastProtos.MessageType messageType,
byte[] message)
Send the given message to everyone on the network.
|
static void |
main(java.lang.String[] args) |
static java.net.InetAddress[] |
readKubernetesState()
Read the Kubernetes broadcast state from a file.
|
boolean |
sendTransport(java.lang.String destination,
UDPBroadcastProtos.MessageType messageType,
byte[] message)
Send a message over the transport to a destination.
|
java.lang.String |
toString() |
public final java.net.InetAddress serverName
public final boolean thread
public final boolean zip
public final int mtu
public final boolean allowJumboPackets
public UDPTransport()
throws java.io.IOException
java.io.IOExceptionUDPTransport(int, int, boolean, boolean, boolean)public static java.net.InetAddress[] readKubernetesState()
throws java.io.IOException
java.io.IOException - Thrown if we could not read the Kubernetes state.public void bind(UDPBroadcastProtos.MessageType channel, java.util.function.Consumer<byte[]> listener)
public boolean sendTransport(java.lang.String destination,
UDPBroadcastProtos.MessageType messageType,
byte[] message)
sendTransport in interface Transportdestination - The destination we're sending to.messageType - The type of message we're sending.message - The message we're sending.public boolean broadcastTransport(UDPBroadcastProtos.MessageType messageType, byte[] message)
broadcastTransport in interface TransportmessageType - The type of message we're sending.message - The messge to sendpublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException