public void PollServer() { if (!telnetClient.Connected) { return; } int dataLength; byte[] dataBytes; dataLength = telnetClient.ReceiveData(); dataBytes = telnetClient.GetData(); for (int i = 0; i < dataLength; ++i) { switch (dataBytes[i]) { // Interpret As Command case TelnetHelper.IAC: i = ProcessIAC(dataBytes, dataLength, i); break; // Terminal Command case TelnetHelper.ESC: i = ProcessTerminalData(dataBytes, dataLength, i); break; } } }