161 |
} |
} |
162 |
|
|
163 |
/** |
/** |
164 |
|
* Sets the interface to use for sending multicast packets. |
165 |
|
* |
166 |
|
* @param addr The new interface to use. |
167 |
|
* |
168 |
|
* @exception SocketException If an error occurs. |
169 |
|
* |
170 |
|
* @since 1.4 |
171 |
|
*/ |
172 |
|
public void setInterface(InetAddress inf) throws SocketException |
173 |
|
{ |
174 |
|
impl.setOption(SocketOptions.IP_MULTICAST_IF, inf); |
175 |
|
} |
176 |
|
|
177 |
|
/** |
178 |
* Sets the local network interface used to send multicast messages |
* Sets the local network interface used to send multicast messages |
179 |
* |
* |
180 |
* @param netIF The local network interface used to send multicast messages |
* @param netIF The local network interface used to send multicast messages |
227 |
} |
} |
228 |
|
|
229 |
/** |
/** |
230 |
* Sets the interface to use for multicast packets. |
* Disable/Enable local loopback of multicast packets. The option is used by |
231 |
|
* the platform's networking code as a hint for setting whether multicast |
232 |
|
* data will be looped back to the local socket. |
233 |
* |
* |
234 |
* @param addr The new interface to use |
* Because this option is a hint, applications that want to verify what |
235 |
|
* loopback mode is set to should call #getLoopbackMode |
236 |
|
* |
237 |
|
* @param disable True to disable loopback mode |
238 |
* |
* |
239 |
* @exception SocketException If an error occurs |
* @exception SocketException If an error occurs |
240 |
* |
* |
241 |
* @since 1.4 |
* @since 1.4 |
242 |
*/ |
*/ |
243 |
public void setInterface(InetAddress inf) throws SocketException |
public void setLoopbackMode(boolean disable) throws SocketException |
244 |
{ |
{ |
245 |
impl.setOption(SocketOptions.IP_MULTICAST_IF, inf); |
if (impl == null) |
246 |
|
throw new SocketException ( |
247 |
|
"MulticastSocket: Cant access socket implementation"); |
248 |
|
|
249 |
|
impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable)); |
250 |
|
} |
251 |
|
|
252 |
|
/** |
253 |
|
* Checks if local loopback mode is enabled or not |
254 |
|
* |
255 |
|
* @exception SocketException If an error occurs |
256 |
|
* |
257 |
|
* @since 1.4 |
258 |
|
*/ |
259 |
|
public boolean getLoopbackMode() throws SocketException |
260 |
|
{ |
261 |
|
Object obj = impl.getOption (SocketOptions.IP_MULTICAST_LOOP); |
262 |
|
|
263 |
|
if (obj instanceof Boolean) |
264 |
|
return ((Boolean) obj).booleanValue (); |
265 |
|
else |
266 |
|
throw new SocketException ("Unexpected type"); |
267 |
} |
} |
268 |
|
|
269 |
/** |
/** |