日期:2014-05-17 浏览次数:21140 次
/// <summary>
/// 开始侦听,这个方法是启动侦听的方法
/// </summary>
void StartListen()
{
try
{
log.InfoFormat("运行接收服务。");
var ServiceName = "PSPIPDRSCWinService";
myListenerAndExcutor = MonitorServerCommand.GetInstance();
ServiceName = System.Configuration.ConfigurationManager.AppSettings["ServiceName"];
myListenerAndExcutor.allDone = allDone;
myListenerAndExcutor.Port = System.Configuration.ConfigurationManager.AppSettings["ServicePort"].ConvertStrToInt(7100);
;
if (myListenerAndExcutor == null)
{
myListenerAndExcutor = MonitorServerCommand.GetInstance();
}
myListenerThread = new Thread(new ThreadStart(myListenerAndExcutor.ListenClientConnect));
myListenerThread.Name = "PSPITcpLienster";
//开始监听
myListenerThread.Start();
}
catch (Exception ex)
{
log.FatalFormat("运行接收服务时错:{0}——{1}", ex.InnerException == null ? ex.Message : (ex.InnerException.Message ?? ex.Message), DateTime.Now);
&n