protected override void OnStart(string[] args) { _serialPort = new SerialPortControl(); if (!_serialPort.openComPort(comPort)) { Trace.WriteLine(DateTime.Now + " Open com port failed! "); return; } tcpServer = new TcpTimeServer(_serialPort, Convert.ToInt32(port)); //11000 StartService(this.ServiceName, 10000); }
/****************************************************************** * purpose: bypass the exterial TCP server handler to local variable * parameter: * Input: _tcpTimeServer: tcp time server handler * Output: ********************************************************************/ public void readTCPListener(TcpTimeServer _tcpTimeServer) { tcpTimeServer = _tcpTimeServer; }