public static void main(String argv[]) throws IOException, InterruptedException
	{
		//These variables should input from the GUI
		int port = 8080;
		String hostname = "localhost";
		String sharedKey = "thequickbrownfox"; // length 16

		UI ui = new UI();
		ui.setState(0);
		
		try
		{
			while(ui.getStart() == 0)
			{
				Thread.sleep(1);
			}
			ui.setStart(0);
			try
			{
				port = ui.getPort();
				System.out.println("Port: "+port);
				sharedKey = ui.getKeyVal();
				System.out.println("keyVal: "+sharedKey);
				hostname = ui.getIp();
				System.out.println("Hostname: "+hostname);
				
				if (ui.getState() == 1)
				{
					System.out.println("State1");
					try
					{
						TCPServer server = new TCPServer(port, sharedKey.getBytes("UTF-8"), ui);
						System.out.println("Set server TCP");
						ui.node = server;
						server.run();
					}
					catch(Exception e)
					{
						System.out.println("Error");
					}
				}
				else if (ui.getState() == 0)
				{
					try
					{
						System.out.println("State0");
						TCPClient client = new TCPClient(hostname, port, sharedKey.getBytes("UTF-8"), ui);
						System.out.println("Set client TCP");
						ui.node = client;
						client.run();
					}
					catch(Exception e)
					{
						System.out.println("Error");
					}
				}
				else
				{
					System.out.println("Invalid selection.");
					
				}
				
			}
			catch(Exception e)
			{
				ui.consoleMessage("Incorrect input");
				System.out.println(e.getMessage());
			}
		}
		catch (Exception e)
		{
			ui.consoleMessage("Error");
			System.out.println(e.getMessage());
		}
	}