public static void main(String[] args) {
		
		// ----------------------------------------------------------------------
		// initialize TF hardware
		// ----------------------------------------------------------------------
        while(true) {
            try {
                // try to connect
            	ipcon.connect(robohost, roboport);
                break;
            } catch(Exception e) {
            	e.printStackTrace();
            }
            try {
                Thread.sleep(2000);
            } catch(InterruptedException ei) {
            }
        }
		
        hardwareManager = new HardwareManager(ipcon);
        ipcon.addEnumerateListener(hardwareManager);
        ipcon.addConnectedListener(hardwareManager);
        
        
        while(true) {
            try {
            	// try to configure hardware
                ipcon.enumerate();
                break;
            } catch(NotConnectedException e) {
            	e.printStackTrace();
            }
            try {
                Thread.sleep(2000);
            } catch(InterruptedException ei) {
            }
        }

        
		// ----------------------------------------------------------------------
		// start web server
		// ----------------------------------------------------------------------
		final Server server = new Server(serverhost, serverport, ipcon);
		try {
			server.start();
			System.out.println("Web Server started.....");
		} catch (IOException e) {
			e.printStackTrace();
		}       

		
        // ---------------------------------------------------------------------
        // On server shutdown
        // ---------------------------------------------------------------------
		Runtime.getRuntime().addShutdownHook(new Thread(){
			public void run(){
				server.stop();
				try {
					
					ipcon.disconnect();
				} catch (NotConnectedException e) {
					e.printStackTrace();
				}
			}
		});
	}