DatagramSocket GetBroadcast() Example
Tests if SO_BROADCAST is enabled.
DatagramSocketclass GetBroadcast() method example. This example shows you how to use GetBroadcast() method.This method Tests if SO_BROADCAST is enabled.
Here is the code:-
/**
* @Program that Tests if SO_BROADCAST is enabled.
* GetBroadcast.java
* Author:-RoseIndia Team
* Date:-20-jun-2008
*/
import java.net.*;
public class GetBroadcast {
public static void main(String[] args) throws Exception {
DatagramSocket ds = new DatagramSocket();
ds.connect(new InetSocketAddress(9090));
//Tests if SO_BROADCAST is enabled.
System.out.println(" SO_BROADCAST is enabled: " + ds.getBroadcast());
}
} |
Output of the program:-
| SO_BROADCAST is enabled: true |
|