41 * The JDK continues to ship with the older implementation to allow code to run 42 * that depends on unspecified behavior that differs between the old and new 43 * implementations. The old implementation will be used if the Java virtual 44 * machine is started with the system property {@systemProperty 45 * jdk.net.usePlainDatagramSocketImpl} set to use the old implementation. It may 46 * also be set in the JDK's network configuration file, located in {@code 47 * ${java.home}/conf/net.properties}. The value of the property is the string 48 * representation of a boolean. If set without a value then it defaults to {@code 49 * true}, hence running with {@code -Djdk.net.usePlainDatagramSocketImpl} or 50 * {@code -Djdk.net.usePlainDatagramSocketImpl=true} will configure the Java 51 * virtual machine to use the old implementation. The property and old 52 * implementation will be removed in a future version. 53 * 54 * @author Pavani Diwanji 55 * @since 1.1 56 */ 57 58 public abstract class DatagramSocketImpl implements SocketOptions { 59 60 /** 61 * The local port number. 62 */ 63 protected int localPort; 64 65 /** 66 * The file descriptor object. 67 */ 68 protected FileDescriptor fd; 69 70 int dataAvailable() { 71 // default impl returns zero, which disables the calling 72 // functionality 73 return 0; 74 } 75 76 /** 77 * Creates a datagram socket. 78 * @throws SocketException if there is an error in the 79 * underlying protocol, such as a TCP error. 80 */ | 41 * The JDK continues to ship with the older implementation to allow code to run 42 * that depends on unspecified behavior that differs between the old and new 43 * implementations. The old implementation will be used if the Java virtual 44 * machine is started with the system property {@systemProperty 45 * jdk.net.usePlainDatagramSocketImpl} set to use the old implementation. It may 46 * also be set in the JDK's network configuration file, located in {@code 47 * ${java.home}/conf/net.properties}. The value of the property is the string 48 * representation of a boolean. If set without a value then it defaults to {@code 49 * true}, hence running with {@code -Djdk.net.usePlainDatagramSocketImpl} or 50 * {@code -Djdk.net.usePlainDatagramSocketImpl=true} will configure the Java 51 * virtual machine to use the old implementation. The property and old 52 * implementation will be removed in a future version. 53 * 54 * @author Pavani Diwanji 55 * @since 1.1 56 */ 57 58 public abstract class DatagramSocketImpl implements SocketOptions { 59 60 /** 61 * Constructor for subclasses to call. 62 */ 63 public DatagramSocketImpl() {} 64 65 /** 66 * The local port number. 67 */ 68 protected int localPort; 69 70 /** 71 * The file descriptor object. 72 */ 73 protected FileDescriptor fd; 74 75 int dataAvailable() { 76 // default impl returns zero, which disables the calling 77 // functionality 78 return 0; 79 } 80 81 /** 82 * Creates a datagram socket. 83 * @throws SocketException if there is an error in the 84 * underlying protocol, such as a TCP error. 85 */ |