/// <summary> /// Deregisters this client with the server. /// </summary> public void Deregister() { if (state == ClientState.Running) { // Deregister our client. SendMessage(new IProcEventRegistration(localEndPoint, false).ToBuffer()); } // Shutdown the connection. Shutdown(); errorCallback = null; localEndPoint = null; }
/// <summary> /// Initializes an instance of the object. /// </summary> /// <param name="errorHandler">Delegate that gets called if an error occurs. A null may be passed in /// if the application does not care to be notified of errors.</param> /// <param name="context">Context that is passed to the error handler.</param> public IProcEventClient(IProcEventError errorHandler, object context) { // Create a socket to communicate with the event server on. eventSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); state = ClientState.Initializing; // Save the error handling information. errorCallback = errorHandler; errorContext = context; // Start the event thread waiting for event messages. Thread thread = new Thread(new ThreadStart(EventThread)); thread.Name = "IProc Event Client"; thread.Priority = ThreadPriority.BelowNormal; thread.IsBackground = true; thread.Start(); }