Code example for DatagramSocket

Methods: getSoTimeout, setSoTimeout

0
        ds.setSendBufferSize(134);
        assertTrue("Incorrect buffer size", ds.getSendBufferSize() >= 134);
    } 
 
    public void test_getSoTimeout() throws Exception { 
        DatagramSocket ds = new DatagramSocket();
        ds.setSoTimeout(100);
        assertEquals("Returned incorrect timeout", 100, ds.getSoTimeout());
    } 
 
    public void test_receiveLjava_net_DatagramPacket() throws IOException { 
        // Test for method void 
        // java.net.DatagramSocket.receive(java.net.DatagramPacket) 
 
        receive_oversize_java_net_DatagramPacket(); 
        final int[] ports = Support_PortManager.getNextPortsForUDP(2);
        final int portNumber = ports[0];
 
        class TestDGRcv implements Runnable {
            public void run() { 
                InetAddress localHost = null;