|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.net.DatagramSocket
java.net.MulticastSocket
public class MulticastSocket
This class models a multicast socket for sending & receiving datagram packets to a multicast group.
DatagramSocket| Field Summary | |
|---|---|
(package private) static int |
SO_REUSEPORT
|
| Fields inherited from class java.net.DatagramSocket |
|---|
address, factory, impl, isBound, port |
| Constructor Summary | |
|---|---|
MulticastSocket()
Constructs a multicast socket, bound to any available port on the localhost. |
|
MulticastSocket(int aPort)
Returns a multicast socket, bound to the nominated port on the localhost. |
|
MulticastSocket(SocketAddress localAddr)
Constructs a MulticastSocket bound to the host/port specified by the SocketAddress, or an unbound DatagramSocket if the SocketAddress is null. |
|
| Method Summary | |
|---|---|
(package private) void |
createSocket(int aPort,
InetAddress addr)
|
InetAddress |
getInterface()
Answer the network address used by the socket. |
boolean |
getLoopbackMode()
Get the state of the IP_MULTICAST_LOOP socket option. |
NetworkInterface |
getNetworkInterface()
Answer the network interface used by the socket. |
int |
getTimeToLive()
Answer the time-to-live (TTL) for multicast packets sent on this socket. |
byte |
getTTL()
Deprecated. Replaced by getTimeToLive() |
(package private) boolean |
isMulticastSocket()
Returns whether this socket is multicast. |
void |
joinGroup(InetAddress groupAddr)
Add this socket to the multicast group. |
void |
joinGroup(SocketAddress groupAddress,
NetworkInterface netInterface)
Add this socket to the multicast group. |
void |
leaveGroup(InetAddress groupAddr)
Remove the socket from the multicast group. |
void |
leaveGroup(SocketAddress groupAddress,
NetworkInterface netInterface)
Remove the socket from the multicast group. |
void |
send(DatagramPacket pack,
byte ttl)
Deprecated. use setTimeToLive(int) |
void |
setInterface(InetAddress addr)
Set the network address used by the socket. |
void |
setLoopbackMode(boolean loop)
Set the IP_MULTICAST_LOOP socket option. |
void |
setNetworkInterface(NetworkInterface netInterface)
Set the network interface used by the socket. |
void |
setTimeToLive(int ttl)
Set the time-to-live (TTL) for multicast packets sent on this socket. |
void |
setTTL(byte ttl)
Deprecated. Replaced by setTimeToLive(int) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final int SO_REUSEPORT
| Constructor Detail |
|---|
public MulticastSocket()
throws IOException
IOException - if a problem occurs creating or binding the socket
public MulticastSocket(int aPort)
throws IOException
aPort - the port to bind on the localhost
IOException - if a problem occurs creating or binding the socket
public MulticastSocket(SocketAddress localAddr)
throws IOException
localAddr - the local machine address and port to bind to
IllegalArgumentException - if the SocketAddress is not supported
IOException - if a problem occurs creating or binding the socket| Method Detail |
|---|
public InetAddress getInterface()
throws SocketException
SocketException - The exception thrown while getting the address
public NetworkInterface getNetworkInterface()
throws SocketException
SocketException - The exception thrown while getting the address
public int getTimeToLive()
throws IOException
IOException - The exception description.
@Deprecated
public byte getTTL()
throws IOException
getTimeToLive()
IOException - The exception description.getTimeToLive()boolean isMulticastSocket()
DatagramSocket
isMulticastSocket in class DatagramSocket
public void joinGroup(InetAddress groupAddr)
throws IOException
groupAddr - the multicast group to be joined
IOException - may be thrown while joining a group
public void joinGroup(SocketAddress groupAddress,
NetworkInterface netInterface)
throws IOException
groupAddress - the multicast group to be joinednetInterface - the network interface on which the addresses should be dropped
IOException - will be thrown if address is not a multicast address
SecurityException - will be thrown if caller is not authorized to join group
IllegalArgumentException - will be through if groupAddr is null
public void leaveGroup(InetAddress groupAddr)
throws IOException
groupAddr - the multicast group to be left
IOException - will be thrown if address is not a multicast address
SecurityException - will be thrown if caller is not authorized to join group
IllegalArgumentException - will be through if groupAddr is null
public void leaveGroup(SocketAddress groupAddress,
NetworkInterface netInterface)
throws IOException
groupAddress - the multicast group to be leftnetInterface - the network interface on which the addresses should be dropped
IOException - will be thrown if address is not a multicast address
SecurityException - will be thrown if caller is not authorized to join group
IllegalArgumentException - will be through if groupAddr is null
@Deprecated
public void send(DatagramPacket pack,
byte ttl)
throws IOException
setTimeToLive(int)
pack - the DatagramPacket to sendttl - the TTL setting for this transmission, overriding the socket
default
IOException - If a send error occurs.
public void setInterface(InetAddress addr)
throws SocketException
addr - java.net.InetAddress the interface network address
SocketException - the exception may be thrown while setting the address
public void setNetworkInterface(NetworkInterface netInterface)
throws SocketException
netInterface - NetworkInterface the interface to be used
SocketException - the exception may be thrown while setting the address
public void setTimeToLive(int ttl)
throws IOException
ttl - the time-to-live, 0<=ttl<= 255
IOException - The exception thrown while setting the TTL
@Deprecated
public void setTTL(byte ttl)
throws IOException
setTimeToLive(int)
ttl - the time-to-live, 0IOException - The exception thrown while setting the TTLsetTimeToLive(int)
void createSocket(int aPort,
InetAddress addr)
throws SocketException
createSocket in class DatagramSocketSocketException
public boolean getLoopbackMode()
throws SocketException
true if the IP_MULTICAST_LOOP is enabled,
false otherwise.
SocketException - if the socket is closed or the option is invalid.
public void setLoopbackMode(boolean loop)
throws SocketException
loop - the socket IP_MULTICAST_LOOP option setting
SocketException - if the socket is closed or the option is invalid.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||