/// <summary>
        /// Default constructor for opening a connection to the dialer
        /// </summary>
        /// <param name="agent">The <typeparamref name="DialerAgent"/> opening the connection</param>
        public DialerConnection(string dialerAddress, string ipAddress, int port)
        {
            IPAddress = ipAddress;
            Port = port;
            _messagesDocument = XDocument.Load("Messages.xml");
            _dialerAddress = dialerAddress;
            //Read in our custom configuration section
            //Configuration.DialerConnectionConfigurationSection config = (Configuration.DialerConnectionConfigurationSection)ConfigurationManager.GetSection("dialerConnectionGroup/dialerConnectionSection");

            //If the agent is configured to log messages, set up the file for tracing
            //if (config.Tracing.Enabled)
            //{
            //    //Keep track of whether we are tracing or not
            //    _isTracing = true;

            //    //Get the path to the folder messages will be stored in
            //    string path = config.Tracing.Path;
            //    //Build a full filename using the path provided and the current time
            //    string output = System.IO.Path.Combine(path, string.Format("{0}_{1:yyyyMMdd_hhmmss}.txt", Agent.Name, DateTime.Now));

            //    //Initialize our stream writer with the new path we built
            //    _log = new StreamWriter(output);
            //    //Make sure the stream pushes any new data we send to it right to the file
            //    _log.AutoFlush = true;
            //}
            //Initialize our socket with the server and port specificed in the custom configuration section.  Also pass in our delegate for capturing new messages.
            _socket = new DialerSocket(IPAddress, Port, NewMessageReceived);
            //_socket.Send(_dialerAddress + Environment.NewLine);

            //Initialize the empty list of commands.
            _waitingCommands = new List<Command>();
        }
 public void Reset()
 {
     _socket = new DialerSocket(IPAddress, Port, NewMessageReceived);
     //_socket.Send(_dialerAddress + Environment.NewLine);
 }