log.error("-use_all_interfaces flag requires JDK 1.4 or greater");
System.err.println("-use_all_interfaces flag requires JDK 1.4 or greater");
    public static void main(String args[]) {		MulticastSocket[] sockets=null;	MulticastSocket   sock;	InetAddress       mcast_addr=null, bind_addr=null;	DatagramPacket    packet;	byte[]            buf=new byte[0];	String            tmp;	int               ttl=32;	String            line;	DataInputStream   in;	AckReceiver       ack_receiver=null;	boolean           use_all_interfaces=false;	int               port=5555;	try {	    for(int i=0; i < args.length; i++) {		tmp=args[i];		if("-help".equals(tmp)) {		    help();		    return;		}		if("-bind_addr".equals(tmp)) {		    bind_addr=InetAddress.getByName(args[++i]);		    continue;		}		if("-mcast_addr".equals(tmp)) {		    mcast_addr=InetAddress.getByName(args[++i]);		    continue;		}		if("-ttl".equals(tmp)) {		    ttl=Integer.parseInt(args[++i]);		    continue;		}		if("-port".equals(tmp)) {		    port=Integer.parseInt(args[++i]);		    continue;		}		if("-use_all_interfaces".equals(tmp)) {		    use_all_interfaces=true;		    continue;		}		help();		return;	    }	    if(mcast_addr == null)		mcast_addr=InetAddress.getByName("224.0.0.150");	    if(use_all_interfaces) {		if(!is1_4()) {		    log.error("-use_all_interfaces flag requires JDK 1.4 or greater");		    return;		}	    }	    	}	catch(Exception ex) {	    log.error(ex);	    return;	}	try {	    if(use_all_interfaces) {		Vector v=new Vector();				for(Enumeration en=NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {		    NetworkInterface intf=(NetworkInterface)en.nextElement();		    for(Enumeration e2=intf.getInetAddresses(); e2.hasMoreElements();) {			bind_addr=(InetAddress)e2.nextElement();			v.addElement(bind_addr);		    }		}		sockets=new MulticastSocket[v.size()];		for(int i=0; i < v.size(); i++) {		    sock=new MulticastSocket(port);		    sock.setTimeToLive(ttl);		    sock.setInterface((InetAddress)v.elementAt(i));		    sockets[i]=sock;		    ack_receiver=new AckReceiver(sock);		    ack_receiver.start();		}	    }	    else {		sockets=new MulticastSocket[1];		sockets[0]=new MulticastSocket(port);		sockets[0].setTimeToLive(ttl);		if(bind_addr != null)		    sockets[0].setInterface(bind_addr);		ack_receiver=new AckReceiver(sockets[0]);		ack_receiver.start();	    }	    for(int i=0; i < sockets.length; i++) {		sock=sockets[i];		if(sock == null) continue;		System.out.println("Socket #" + (i+1) + '=' + sock.getLocalAddress() + ':' + sock.getLocalPort() +				   ", ttl=" + sock.getTimeToLive() + ", bind interface=" + sock.getInterface());	    }	    	    in=new DataInputStream(System.in);	    while(true) {		System.out.print("> ");		line=in.readLine();		if(line.startsWith("quit") || line.startsWith("exit"))		    System.exit(0);		buf=line.getBytes();		packet=new DatagramPacket(buf, buf.length, mcast_addr, port);		send(packet, sockets); // send on all interfaces	    }	}	catch(Exception e) {	    log.error(e);	}    }