我用 SP_IocpDispatcher 做了一个 广播的消息, 发现 会丢数据, 我不知道丢在哪了?

50 views
Skip to first unread message

hylas

unread,
Nov 2, 2009, 4:31:38 AM11/2/09
to spserver
我要做一个服务, 1. 用来广播我要发的信息 . 2. 接受 Client请求, 返回一些数据
我的代码在 testiocpdispatcher 例子程序里改的, 现在发现 广播信息会丢 数据, 我不知道问题出哪? 哪位高手帮我分析
一下 ???

void __stdcall BroadMsg( unsigned int ServID, char* pMsg, int
MsgLen ) //SpServSdk
{
SP_IocpDispatcher* dispatcher = (SP_IocpDispatcher*)ServID;

SP_Message * msg = new SP_Message();
onlineManager.copy( msg->getToList(), NULL );
msg->getMsg()->append( pMsg, MsgLen );

SP_Sid_t sid = { SP_Sid_t::ePushKey, SP_Sid_t::ePushSeq };
SP_Response * response = new SP_Response( sid );
response->addMessage( msg );
dispatcher->push( response );
}

serverID 是刚开始建里起来的 SP_IocpDispatcher

lau stephen

unread,
Nov 2, 2009, 5:19:32 AM11/2/09
to spse...@googlegroups.com
丢数据具体的情况是怎么样呢?
比如有多少个在线的连接?有多少个会收到信息?多少没收到?

2009/11/2 hylas <reh...@sina.com>:

hylas

unread,
Nov 2, 2009, 6:35:37 AM11/2/09
to spserver

On Nov 2, 6:19 pm, lau stephen <stephen....@gmail.com> wrote:
> 丢数据具体的情况是怎么样呢?
> 比如有多少个在线的连接?有多少个会收到信息?多少没收到?
>

> 2009/11/2 hylas <rehy...@sina.com>:
>

就一个连接, 数据发送比较频繁 , 可能一秒钟内很多个 respone . 我觉得应该是spserver 下面直接把我过滤掉了..

lau stephen

unread,
Nov 2, 2009, 6:42:52 AM11/2/09
to spse...@googlegroups.com
spserver 不会做过滤的。

自己写个 SP_CompletionHandler 的实现,在里面的函数中输出已处理的信息。
对比一下,可以看看是什么情况。

2009/11/2 hylas <reh...@sina.com>:

Reply all
Reply to author
Forward
0 new messages