网狐框架分析一

---
#1. 基本流程
    客户端同服务器建立通信连接
    服务器判断游戏是否开始(客户端等待其它玩家入位再游戏或者直接和服务器进行游戏)
    客户端同服务器进行交互及客户端界面展示
    游戏结束,进入下一局,循环。
    或者客户端离开,中断连接。
    




#2.图示
##2.1 流程图


```flow
st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end


st->op->cond
cond(yes)->e
cond(no)->op
```
---
##2.2 时序图


```seq
Note left of Client: html5
Client->Server: 发起登录请求(var socket=new WebSocket(host);)
Server-->QueueService::OnQueueServiceThread:
QueueService-->CAttemperEngine::OnQueueServiceSink
CAttemperEngine-->CServerSocketRSThread::OnEventThreadRun
CServerSocketRSThread-->CServerSocketItem::OnRecvCompleted  通过recv接收信息
CServerSocketItem-->CServerSocketItem::SendHandShakeData  发送握手信息到客户端
CServerSocketItem-->Client:: WSASend  (websocket专用格式) 
CServerSocketItem-->CTCPNetworkEngine::OnSocketReadEvent
CTCPNetworkEngine-->PostNetworkReadEvent::
PostNetworkReadEvent-->CQueueService::AddToQueue -->PostQueuedCompletionStatus 加入数据队列






Note left of Server: C++
Server-->Client: I am good thanks!
```


---


```seq


CServiceThread-->CQueueServiceThread::ThreadFunction()-->OnEventThreadRun()
CQueueServiceThread-->CQueueService::OnEventThreadRun()-->OnQueueServiceThread()
CQueueService-->CAttemperEngine::OnQueueServiceThread()-->OnQueueServiceSink()
CAttemperEngine-->CAttemperEngineSink::OnQueueServiceSink()-->OnEventTCPNetworkRead()
CAttemperEngineSink-->CTCPNetworkEngine:: OnEventTCPNetworkRead()-->SendData()
CTCPNetworkEngine-->CQueueService:: SendData()-->AddToQueue()-->PostQueuedCompletionStatus()


```

你可能感兴趣的:(网狐框架分析一)