public void start(motSocket.__void_delegate __callback) { try { __start_listener(__listener_port, __callback); //__logger.Info("HL7 Listener waiting on port: {0}", __listener_port); } catch (Exception e) { string __err = string.Format("HL7 Listener failed to start on port {0}: {1} ", __listener_port, e.Message); //__logger.Info(__err); throw new Exception(__err); } }
public void __start_listener(int __port, motSocket.__void_delegate __callback_p) { try { Console.WriteLine("__start_listener: {0}", Thread.CurrentThread.ManagedThreadId); __socket = new motSocket(__port, __callback_p); // This will start the listener and call the callback __worker = new Thread(new ThreadStart(__socket.listen)); __worker.Name = "listener"; __worker.Start(); } catch (Exception e) { string __err = string.Format("An error occurred while attempting to start the HL7 listener: {0}\nExiting ...", e.Message); Console.WriteLine(__err); //__logger.Error(__err); } }