public void Dispose() { try { stxetxClient.Dispose(); stxetxClient = null; } catch { } }
/// <summary> /// constructor for when an STXETX handler is already in place /// </summary> /// <param name="stxetxClient"></param> /// <param name="optionalTS"></param> public CommandHandler(StxEtxHandler stxetxClient, TraceSource optionalTS = null) { if (optionalTS == null) { ts = new TraceSource("dummy"); } else { ts = optionalTS; } this.stxetxClient = stxetxClient; }
/// <summary> /// Constructor for when a TCP/IP connection must be established /// </summary> /// <param name="hostname"></param> /// <param name="optionalTS"></param> /// <param name="optionalPort"></param> public CommandHandler(string hostname, TraceSource optionalTS = null, int optionalPort = 1100) { if (optionalTS == null) { ts = new TraceSource("dummy"); } else { ts = optionalTS; } LogMsg(TraceEventType.Information, "Initiating connection to: " + hostname); stxetxClient = new StxEtxHandler(new TCPconnManager(ts).ConnectToServer(hostname, optionalPort), true); LogMsg(TraceEventType.Information, "Server connection established."); }