public static void main(String [] args) throws java.net.UnknownHostException, java.io.IOException {
	System.out.println("java.library.path="+System.getProperty("java.library.path"));

	JtunDevice tunDev = JtunDevice.getTunDeviceInstance();

	byte [] buf = new byte[1600];
	
	byte [] _no_eth_frame;

	if(tunDev.open()) {
	    
	    System.out.println("The TAP device was opened successfully");
	    System.out.println("TAP device name : " + tunDev.getDevName());
	    System.out.println("TAP device status : " + tunDev.isInitialized());
	}

	tunDev.setMTU(1350);

	java.net.InetAddress address = Inet4Address.getByName("10.0.0.4");

	if (!tunDev.addAddress(address, 8)) {
	    System.out.println("Failed to set up the address " + address.toString());
	}
	
	tunDev.setUseSelectTimeout(true);
	tunDev.setReceiveTimeout(10);

	System.out.println("TUN MAC address : " + Converter.__toHexString(tunDev.getMACAddress(), ":"));
	//tunDev.setSendTimeout(10);
	long start = System.currentTimeMillis();
	long now   = System.currentTimeMillis();
	int err   = 0;

	IPPacket __icmp;

	ARPPacket __arp = new ARPPacket(1);

	ARPPacket __arpResponse;

	byte [] __snd_mca = new byte[6];

	byte [] __full_frame;

	byte [] __src = new byte[4];

	byte [] __dst = new byte[4];
	
	while (now - start < 60000000) {
	    now   = System.currentTimeMillis();
	    try {
		if ((err = tunDev.read(buf)) > 0) {
		    buf = Converter.__toUnsignedByteArray(buf);
		    _no_eth_frame = new byte[err - 14]; //Remove the Ethernet frame and CRC field
		    System.arraycopy(buf, 14, _no_eth_frame, 0, err - 14);

		    if (__isARPRequest(buf)) {
			System.out.println("Packet is ARP_REQUEST");
			__full_frame = new byte[_no_eth_frame.length + 14];
						
			__arp.setData(_no_eth_frame);		
			__arp.getSenderHdwAddr(__snd_mca);
			__arp.setDestHdwAddr(__snd_mca);

			__arp.setOpCode(2);

			__arp.getDestProtoAddr(__src);
			__arp.getSourceProtoAddr(__dst);

			__arp.setDestProtoAddr(__dst);
			__arp.setSourceProtoAddr(__src);
			
			__setEthHeader(__full_frame, _no_eth_frame, __snd_mca, __snd_mca, (short)0x0806);
			
			try {
			    System.out.println(tunDev.write(__full_frame) + " bytes were sent");
			}catch (Exception ex) {
			    System.out.println(ex.getMessage());
			}
			System.out.println(Converter.__toHexString(__full_frame, " "));			
			
		    } else if (__isIPPacket(buf)) {
			__icmp = new IPPacket(1);
			__icmp.setData(_no_eth_frame);
			System.out.println("IP version : " + __icmp.getIPVersion());
		    }
		} 
	    } catch (java.io.InterruptedIOException ex) {
		//System.out.println(ex.getMessage());
	    }
	}
	
	tunDev.close();
	System.out.println("The TAP device was closed successfully");
	System.out.println("TAP device status : " + tunDev.isInitialized());
    }