##1 登录服务器 LogonServer启动流程
```flow
st=>start: Start
io=>inputoutput: verification
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end
st->io->op->cond
cond(yes)->e
cond(no)->op
```
---
#2 流程分析
##LogonServerDlg(OnBnClickedStartService) //启动
##=>m_LogonService.StartService() //启动服务
==>m_TimerEngine->StartService() //时间引擎
===>m_TimerThread.StartThread() //启动服务
===>CServiceThread::StartThread()//进入函数,打开监听线程_beginthreadex
====> CServiceThread::ThreadFunction()//线程函数
=====>pServiceThread->OnEventThreadRun()//while循环中的函数
==>m_TCPSocketCorrespond->StartService()//网络引擎
===>CQueueService::StartService()//
====>CreateIoCompletionPort //建立完成端口
====> CServiceThread::StartThread()//启动监听线程_beginthreadex
=====>pServiceThread->OnEventThreadRun()//一个while循环监听函数
==>m_AttemperEngine->StartService()//调度引擎
===>m_QueueService.StartService()//启动队列
===>CQueueService::StartService()//建立完成端口,启动线程
====>m_QueueServiceThread.StartThread()//
====>CServiceThread::StartThread()//_beginthreadex
=====>CServiceThread::ThreadFunction()//
======>pServiceThread->OnEventThreadRun()//while循环调用函数
==>m_DataBaseEngine->StartService()//数据引擎
===>CDataBaseEngine::StartService()//启动服务
====>m_QueueServiceEvent.SetQueueServiceSink()//设置队列
=====>CQueueService::StartService()//建立完成端口,起线程
======>m_QueueServiceThread.StartThread()//
======> CServiceThread::StartThread()//_beginthreadex
=======>pServiceThread->OnEventThreadRun()//while循环调用函数
====>m_pIDataBaseEngineSink->OnDataBaseEngineStart()//启动外挂
=====>CDataBaseSink::OnDataBaseEngineStart()//模块启动
=====>m_AccountsDBModule->SetConnectionInfo()//连数据库
======>CDataBase::SetConnectionInfo()//设置构造连接字符串
=====>m_AccountsDBModule->OpenConnection()//发起连接
======>CDataBase::OpenConnection()//发起连接
=======>m_DBConnection->Open()//_ConnectionPtr m_DBConnection;//数据库对象
==>m_TCPNetworkEngine->StartService()//网络引擎
===>CTCPNetworkEngine::StartService()//
//1.获取cpu线程数
//2.建立完成端口(启动监听线程while循环调用函数)
//3.建立监听SOCKET
//4.启动发送队列 m_SendQueueService.StartService();
//5.建立读写线程,建立应答线程,运行读写线程,网络检测线程,运行应答线程