@Override
	protected Integer doInBackground() throws Exception
	{
		String line;

		try {
			publish("connecting");
			connection = new Connection(ip.getText(), Integer.parseInt(port.getText()));
			publish("connected");
			while ((line = connection.readLine()) != null && !isCancelled()) {
				publish(line);
			}

			if (isCancelled()) {
				publish("disconnecting");
				connection.close();
				publish("disconnected");
				return null;
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			publish("connect error");
		}
		return null;
	}