|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
An interface to an underlying multicast socket. This interface has many of the same methods as java.net.MulticastSocket, but allows different datagram socket implementations to be plugged in.
| Method Summary | |
boolean |
getLoopbackMode()
Get the setting for local loopback of multicast datagrams. |
java.net.NetworkInterface |
getNetworkInterface()
Get the multicast network interface set. |
int |
getTimeToLive()
Get the default time-to-live for multicast packets sent out on the socket. |
void |
joinGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
Joins the specified multicast group at the specified interface. |
void |
leaveGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
Leave a multicast group on a specified local interface. |
void |
setLoopbackMode(boolean disable)
Disable/Enable local loopback of multicast datagrams The option is used by the platform's networking code as a hint for setting whether multicast data will be looped back to the local socket. |
void |
setNetworkInterface(java.net.NetworkInterface netIf)
Specify the network interface for outgoing multicast datagrams sent on this socket. |
void |
setTimeToLive(int ttl)
Set the default time-to-live for multicast packets sent out on this MulticastSocket in order to control the
scope of the multicasts. |
| Methods inherited from interface p2ps.imp.net.DatagramSocket |
bind, close, connect, disconnect, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, isBound, isClosed, isConnected, newPacket, newPacket, receive, send, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout |
| Method Detail |
public void joinGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
throws java.io.IOException
If there is a security manager, this method first
calls its checkMulticast method
with the mcastaddr argument
as its argument.
mcastaddr - is the multicast address to joinnetIf - specifies the local interface to receive multicast
datagram packets, or null to defer to the interface set by
MulticastSocket.setInterface(java.net.InetAddress) or
MulticastSocket.setNetworkInterface(java.net.NetworkInterface)
java.io.IOException - if there is an error joining
or when the address is not a multicast address.
java.lang.SecurityException - if a security manager exists and its
checkMulticast method doesn't allow the join.
java.lang.IllegalArgumentException - if mcastaddr is null or is a
SocketAddress subclass not supported by this socketSecurityManager.checkMulticast(java.net.InetAddress)
public void leaveGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
throws java.io.IOException
If there is a security manager, this method first
calls its checkMulticast method
with the mcastaddr argument
as its argument.
mcastaddr - is the multicast address to leavenetIf - specifies the local interface or null to defer
to the interface set by
MulticastSocket.setInterface(java.net.InetAddress) or
MulticastSocket.setNetworkInterface(java.net.NetworkInterface)
java.io.IOException - if there is an error leaving
or when the address is not a multicast address.
java.lang.SecurityException - if a security manager exists and its
checkMulticast method doesn't allow the operation.
java.lang.IllegalArgumentException - if mcastaddr is null or is a
SocketAddress subclass not supported by this socketSecurityManager.checkMulticast(java.net.InetAddress)
public java.net.NetworkInterface getNetworkInterface()
throws java.net.SocketException
NetworkInterface currently set
java.net.SocketException - if there is an error in
the underlying protocol, such as a TCP error.setNetworkInterface(java.net.NetworkInterface)
public void setNetworkInterface(java.net.NetworkInterface netIf)
throws java.net.SocketException
netIf - the interface
java.net.SocketException - if there is an error in
the underlying protocol, such as a TCP error.getNetworkInterface()
public int getTimeToLive()
throws java.io.IOException
java.io.IOException - if an I/O exception occurs while
getting the default time-to-live valuesetTimeToLive(int)
public void setTimeToLive(int ttl)
throws java.io.IOException
MulticastSocket in order to control the
scope of the multicasts.
The ttl must be in the range 0 <= ttl <=
255 or an IllegalArgumentException will be thrown.
ttl - the time-to-live
java.io.IOException - if an I/O exception occurs
while setting the default time-to-live valuegetTimeToLive()
public boolean getLoopbackMode()
throws java.net.SocketException
java.net.SocketException - if an error occurs while getting the valuesetLoopbackMode(boolean)
public void setLoopbackMode(boolean disable)
throws java.net.SocketException
Because this option is a hint, applications that want to
verify what loopback mode is set to should call
getLoopbackMode()
disable - true to disable the LoopbackMode
java.net.SocketException - if an error occurs while setting the valuegetLoopbackMode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||