internal IAsyncResult BeginSendCommand(int timeout, string command, AsyncCallback cb, object state) { CheckDisposed(); if (null == command) { throw new ArgumentNullException("command", "'command' argument cannot be null"); } command = AppendCRLF(command); SetProgress(true); _response = null; try { _socket.SendTimeout = timeout; byte[] cmdBytes = _encoding.GetBytes(command); CCSendStateObject stateObj = new CCSendStateObject(timeout, cmdBytes, cb, state); _socket.BeginSend(cmdBytes, 0, cmdBytes.Length, new AsyncCallback(this.OnEndSend), stateObj); return(stateObj); } catch (SocketException e) { SetProgress(false); CheckDisposed(); CheckTimeoutException(e); throw; } catch { SetProgress(false); CheckDisposed(); throw; } }