NOTE: packets cannot be received on a socket once connect() is called, due to the semantics of connect() for multicast sockets. Instead, applications should generally use joinGroup(), and then explicitly specify the group address as the destination in all the outbound packets.
Public Member Functions | |
NonblockingMulticastSocket () throws IOException | |
Create a NonblockingMulticastSocket bound to any available port. | |
NonblockingMulticastSocket (int port) throws IOException | |
NonblockingMulticastSocket (int port, InetAddress laddr) throws IOException | |
Create a NonblockingMulticastSocket bound to the given port and the given local address. | |
void | joinGroup (InetAddress addr) throws IOException |
Join a multicast group. | |
void | leaveGroup (InetAddress addr) throws IOException |
Leave a multicast group. | |
int | getTimeToLive () throws IOException |
get the multicast ttl | |
void | setTimeToLive (int ttl) throws IOException |
set the time to live | |
InetAddress | getInterface () |
Get the interface associated with this multicast socket. | |
void | setInterface (InetAddress addr) throws IOException |
Set the interface associated with this socket. | |
void | seeLocalMessages (boolean state) throws IOException |
This sets the state of the IP_MULTICAST_LOOP option on the underlying socket. | |
Package Attributes | |
InetAddress | multicast_interface = null |
int | multicast_ttl = -1 |
seda.nbio.NonblockingMulticastSocket.NonblockingMulticastSocket | ( | ) | throws IOException |
Create a NonblockingMulticastSocket bound to any available port.
seda.nbio.NonblockingMulticastSocket.NonblockingMulticastSocket | ( | int | port | ) | throws IOException |
seda.nbio.NonblockingMulticastSocket.NonblockingMulticastSocket | ( | int | port, | |
InetAddress | laddr | |||
) | throws IOException |
Create a NonblockingMulticastSocket bound to the given port and the given local address.
void seda.nbio.NonblockingMulticastSocket.joinGroup | ( | InetAddress | addr | ) | throws IOException |
Join a multicast group.
void seda.nbio.NonblockingMulticastSocket.leaveGroup | ( | InetAddress | addr | ) | throws IOException |
Leave a multicast group.
int seda.nbio.NonblockingMulticastSocket.getTimeToLive | ( | ) | throws IOException |
get the multicast ttl
void seda.nbio.NonblockingMulticastSocket.setTimeToLive | ( | int | ttl | ) | throws IOException |
set the time to live
InetAddress seda.nbio.NonblockingMulticastSocket.getInterface | ( | ) |
Get the interface associated with this multicast socket.
void seda.nbio.NonblockingMulticastSocket.setInterface | ( | InetAddress | addr | ) | throws IOException |
Set the interface associated with this socket.
void seda.nbio.NonblockingMulticastSocket.seeLocalMessages | ( | boolean | state | ) | throws IOException |
This sets the state of the IP_MULTICAST_LOOP option on the underlying socket.
If state==true, the socket will receive packets it sends out. If false, it will not.
NOTE: The behavior of this is somewhat strange for two multicast listeners on the same physical machine. Ideally, this should be an incoming filter - each socket should throw out packets that it sent out, and not deliver them to the application.
Unfortunately, this instead seems to be an outbound filter - all packets sent out on a socket with IP_MULTICAST_LOOP turned off will be invisible to all sockets on the local machine - regardless of whether or not these other sockets have specified IP_MULTICAST_LOOP=false.
InetAddress seda.nbio.NonblockingMulticastSocket.multicast_interface = null [package] |
int seda.nbio.NonblockingMulticastSocket.multicast_ttl = -1 [package] |