UC故事 2011/11/20 - 2


1. server信息如何传递到client应用层?

void CConference::OnReceiveData(CRtMessageBlock& data)
{
CRtAutoPtr<CInfoSvrPduBase> decPdu;
RtResult ret = CInfoSvrPduBase::DecodePdu(data, decPdu.ParaOut());
        ....
CInfoSvrPduBase* pdu = decPdu.Get();
        ....

switch(pdu->GetType())
{
       ......

//Conference message
case INFO_SVR_PDU_TYPE_CONF_JOIN_RSPN:                                          // 所以,要到CConference才会对Data的业务含义进行解析
HandleJoinConfRspn((CInfoSvrJoinConfRspnPdu*) pdu);
break;

...

}


STACK TRACE: 

CConference::OnReceiveData(CRtMessageBlock & {...}) line 1365
CConfConnection::OnReceiveData(CRtMessageBlock & {...}, IConnection * 0x0205de84) line 170
CRtIMConnection::OnReceive(CRtMessageBlock & {...}, IRtTransport * 0x0205b590, CRtTransportParameter * 0x00000000) line 890 + 50 bytes
CRtEventOnReceive::OnEventFire() line 375 + 50 bytes
CRtEventQueueBase::ProcessOneEvent(IRtEvent * 0x0205b278) line 229 + 12 bytes
CRtEventQueueBase::ProcessEvents(const std::list<IRtEvent *,std::allocator<IRtEvent *> > & {...}) line 217
CRtReactorBase::ProcessHandleEvent(void * 0xffffffff, long 256, int 0, int 1, int 0) line 324 + 18 bytes
CRtReactorWin32Message::Win32SocketWndProc(HWND__ * 0x00130946, unsigned int 1058, unsigned int 4294967295, long 256) line 115
USER32! 77d18734()
USER32! 77d18816()
USER32! 77d189cd()
USER32! 77d196c7()
WTL::CMessageLoop::Run() line 468 + 15 bytes
Run(char * 0x00151f28, int 1) line 207 + 11 bytes
LaunchConf(HINSTANCE__ * 0x00400000, char * 0x00151f28, int 1) line 318 + 13 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00151f28, int 1) line 85 + 20 bytes
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 7c817077()


Q:Win32SockWndProc也是一种消息处理?由消息映射来映射的?

     A:exactly!


class CRtReactorWin32Message : public CRtReactorBase  
{
public:
CRtReactorWin32Message();
virtual ~CRtReactorWin32Message();

......

protected:
virtual RtResult OnHandleRegister(RT_HANDLE aFd, 
IRtEventHandler::MASK aMask, IRtEventHandler *aEh);
virtual void OnHandleRemoved(RT_HANDLE aFd);


static LRESULT CALLBACK Win32SocketWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

         Q: when to be called by whom ???
         A:当任何程序通过PostMessage()发送几个消息(比如与socket有关的)的时候,此函数被调用。如,在Reactor::NotifyHandler()中。2011/12/04

HWND m_hwndNotify;
UINT m_dwTimerId;

};


总结一下:

* 发送:消息->消息处理函数->通过Session代码发送出去

* 接收:特殊消息->消息处理函数->通过Session代码接收进来


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值