public StringBuffer getInput() {
		StringBuffer sb = null;
		
		try {
			byte[] buffer = new byte[1024];
			int offset = 0;
			
			in.mark(buffer.length);
			int len = in.read(buffer, offset, buffer.length - offset);
			offset = 0;
			if (len == -1) {
				return null;
			}

			boolean noIAC = true;
			sb = new StringBuffer();
			for (int i = 0; i < len - 1; i++) {
				if (buffer[i] == IAC) {		
					writeStringBuffer(sb, buffer, offset, i - offset);
					offset = i - offset;
					if (buffer[i + 1] == IAC) {
						offset++;
					} else {
						in.reset();
						in.skip(i + 1);
						System.out.print("RCVD>IAC ");
						interpretTelnetCommand();
						noIAC = false;
						break;
					}
				}
			}
			if (noIAC) {
				if (buffer[len - 1] == IAC) {
					writeStringBuffer(sb, buffer, offset, len - 1);
					buffer[0] = IAC;
					offset = 1;
				} else {
					writeStringBuffer(sb, buffer, offset, len);
					offset = 0;
				}
			} else {
				offset = 0;
			}
		} catch (IOException e) {
		}
		
		return sb;
	}