/// <summary>
        /// Initializes a new OVPN Object.
        /// Also set a LogEventDelegate so that the first log lines are reveived.
        /// </summary>
        /// <param name="bin">Path to openvpn binary</param>
        /// <param name="config">Path to configuration file</param>
        /// <param name="earlyLogEvent">Delegate to a event processor</param>
        /// <param name="earlyLogLevel">Log level</param>
        /// <param name="smartCardSupport">Enable SmartCard support</param>
        /// <seealso cref="Connection.Logs"/>
        public UserSpaceConnection(string bin, string config,
                                   EventHandler <LogEventArgs> earlyLogEvent, int earlyLogLevel, bool smartCardSupport)
        {
            if (bin == null || bin.Length == 0)
            {
                throw new ArgumentNullException(bin, "OpenVPN Binary is not valid/selected");
            }
            if (config == null || config.Length == 0)
            {
                throw new ArgumentNullException(config, "Config file is not valid/selected");
            }
            if (!new FileInfo(bin).Exists)
            {
                throw new FileNotFoundException(bin,
                                                "Binary \"" + bin + "\" does not exist");
            }
            if (!new FileInfo(config).Exists)
            {
                throw new FileNotFoundException(config,
                                                "Config file \"" + config + "\" does not exist");
            }

            String logFile = getLogFile(config);
            String forwardLogFile;

            if (logFile == null)
            {
                forwardLogFile  = Path.GetTempFileName();
                m_logFile       = forwardLogFile;
                m_deleteLogFile = true;
            }
            else
            {
                forwardLogFile  = null;
                m_logFile       = logFile;
                m_deleteLogFile = false;
            }

            this.Init("127.0.0.1", 11195 + obj_count++, earlyLogEvent, earlyLogLevel, true);
            m_ovpnService = new UserSpaceService(bin, config,
                                                 Path.GetDirectoryName(config), Logs, base.Host, base.Port,
                                                 forwardLogFile, smartCardSupport);

            m_ovpnService.serviceExited += new EventHandler(m_ovpnService_serviceExited);
        }
        /// <summary>
        /// Dispose this object.
        /// </summary>
        /// <param name="disposing">true if called from Dispose(), false if called from destructor</param>
        private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (m_deleteLogFile)
                {
                    File.Delete(m_logFile);
                }

                base.Dispose();
                if (disposing)
                {
                    m_ovpnService.Dispose();
                }

                m_ovpnService = null;
                disposed      = true;
            }
        }