log.error("failed creating DatagramSocket: " + ex);
System.err.println("failed creating DatagramSocket: " + ex);
    static int senseMaxFragSize() {        int upper=4096;        int lower=0;        int highest_failed=-1;        DatagramSocket sock;        byte[] buf;        DatagramPacket packet;        InetAddress local_addr;        final int num_iterations=15;        try {            sock=new DatagramSocket();            local_addr=InetAddress.getLocalHost();        }        catch(Exception ex) {            log.error("failed creating DatagramSocket: " + ex);            return lower;        }        for(int i=0; i < num_iterations && lower < upper; i++) { // iterations to approximate frag_size            try {                buf=new byte[upper];                // System.out.println("** upper=" + upper + " (lower=" + lower + ")");                packet=new DatagramPacket(buf, buf.length, local_addr, 9);                sock.send(packet);                lower=Math.max(lower, upper);                System.out.println("-- trying " + lower + " [OK]");                upper=upper * 2;                if(highest_failed > -1)                    upper=Math.min(highest_failed, upper);            }            catch(IOException io_ex) {                if(highest_failed > -1)                    highest_failed=Math.min(highest_failed, upper); // never exceed max_upper                else                    highest_failed=upper;                upper=(upper + lower) / 2;            }            catch(Throwable ex) {                ex.printStackTrace();                break;            }        }        return lower;    }