internal void SendCommand(Command command, Action<Command> responseCallback) { Action<Command> caller = new Action<Command>(SendCommand); caller.BeginInvoke(command, new AsyncCallback(ar => responseCallback(ar.AsyncState as Command)), command); }
/// <summary> /// Method used to send a command to the dialer /// </summary> /// <param name="command">The command to send to the dialer SYCHRONOUSLY</param> internal void SendCommand(Command command) { //Add the command to our list of pending commands lock (((ICollection)_waitingCommands).SyncRoot) _waitingCommands.Add(command); //Get the raw command text String commandText = command.ToString(); //Send the raw command text to the socket _socket.Send(commandText); //If we are tracing, log the raw command text to the file if (_isTracing && _log.BaseStream != null && _log.BaseStream.CanWrite) _log.WriteLine(string.Format("{0:MM/dd/yyyy} {1,10} >> {2}", DateTime.Now, Agent.Name, commandText)); command.Finished.WaitOne(); }