|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.util.UDPMulticastSocket
public class UDPMulticastSocket
This class offers unicast and multicast UDP communication. It binds one MulticastSocket to each network interface address found in the system and sends multicast packets via all of them. Received packets can be either unicast or multicast, and a method to send only unicast packets is also offered.
| Field Summary | |
|---|---|
static java.lang.String[] |
Interface_Names_Blacklist
A list of network interface names not to use for communication. |
| Constructor Summary | |
|---|---|
UDPMulticastSocket(int receivePort,
int sendPort,
java.lang.String multicastGroup)
Creates an UDPMulticastSocket object. |
|
| Method Summary | |
|---|---|
void |
addIncomingMessageListener(MessageListener l)
Register a listener for receiving messages. |
void |
dispose()
Leaves the multicast group on all sockets. |
boolean |
removeIncomingMessageListener(MessageListener l)
De-register a listener for receiving messages. |
void |
sendMulticast(byte[] message)
Sends a multicast message to the group. |
void |
sendTo(byte[] message,
java.net.InetAddress target)
Send a unicast message to a specific address. |
void |
startListening()
Starts one thread for each interface to listen on, if not already started. |
void |
stopListening()
Signals all listening threads to stop and waits for each of them. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[] Interface_Names_Blacklist
| Constructor Detail |
|---|
public UDPMulticastSocket(int receivePort,
int sendPort,
java.lang.String multicastGroup)
throws java.io.IOException
port - The UDP port to use for communication.multicastGroup - The multicast group to use.
java.io.IOException| Method Detail |
|---|
public void sendMulticast(byte[] message)
throws java.io.IOException
message - The message to send.
java.io.IOExceptionaddressIsAlias
public void sendTo(byte[] message,
java.net.InetAddress target)
throws java.io.IOException
message - The message to send.target - The target address to send to.
java.io.IOExceptionpublic void addIncomingMessageListener(MessageListener l)
public boolean removeIncomingMessageListener(MessageListener l)
public void dispose()
public void startListening()
#multicastSockets,
#listenerThreadspublic void stopListening()
shouldExit,
#listenerThreads
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||