MulticastSocket GetTTL() Example
returns the default time-to-live value
MulticastSocketclass GetTTL() method example. This example shows you how to use GetTTL() method.This method returns the default time-to-live value
Here is the code:-
/*
* @Program that Returns the default time-to-live value
* GetTTL.java
* Author:-RoseIndia Team
* Date:-27-Jun-2008
*/
import java.net.*;
public class GetTTL {
public static void main(String[] args) throws Exception {
SocketAddress sa = new InetSocketAddress(8080);
MulticastSocket ms = new MulticastSocket(sa);
// Returns the default time-to-live value
byte b=ms.getTTL();
System.out.println("Default time-to-live value is: "+b);
}
} |
Output of the program:-
| Default time-to-live value is: 1 |
|