MulticastSocket GetNetworkInterface() Example
returns the multicast NetworkInterface currently set
MulticastSocketclass GetNetworkInterface() method example. This example shows you how to use GetNetworkInterface() method.This method returns the multicast NetworkInterface currently set
Here is the code:-
/*
* @Program that Get the multicast network interface set.
* GetNetworkInterface.java
* Author:-RoseIndia Team
* Date:-27-Jun-2008
*/
import java.net.*;
public class GetNetworkInterface {
public static void main(String[] args) throws Exception {
SocketAddress sa = new InetSocketAddress(8080);
MulticastSocket ms = new MulticastSocket(sa);
//Get the multicast network interface set.
System.out.println("network interface set is: "
+ms.getNetworkInterface());
}
} |
Output of the program:-
network interface set is: name:null index: -1 addresses:
0.0.0.0/0.0.0.0; |
|