书签 分享 收藏 举报 版权申诉 / 17

类型boostasio异步tcp通讯及tcp粘包解包解决方案.docx

  • 文档编号:11853912
  • 上传时间:2023-04-06
  • 格式:DOCX
  • 页数:17
  • 大小:17.67KB

/*implementationindependentdeclarations*/

typedefstruct{

nodeType*hdr;/*listHeader*/

intlistLevel;/*currentleveloflist*/

}SkipList;

SkipListlist;/*skiplistinformation*/

#defineNIL

statusEnuminsert(keyTypekey,recType*rec){

inti,newLevel;

nodeType*update[MAXLEVEL+1];

nodeType*x;

/*****

*allocatenodefordataandinsertinlist*

*****/

/*findwherekeybelongs*/

x=;

for(i=;i>=0;i--){

while(x->forward[i]!

=NIL&&compLT(x->forward[i]->key,key))

x=x->forward[i];

update[i]=x;

}

x=x->forward[0];

if(x!

=NIL&&compEQ(x->key,key))

returnSTATUS_DUPLICATE_KEY;

/*determinelevel*/

for(

newLevel=0;

rand()

newLevel++);

if(newLevel>{

for(i=+1;i<=newLevel;i++)

update[i]=NIL;

=newLevel;

}

/*makenewnode*/

if((x=(nodeType*)malloc(sizeof(nodeType)+newLevel*sizeof(nodeType*)))==0)

returnSTATUS_MEM_EXHAUSTED;

x->key=key;

x->rec=*rec;

/*updateforwardlinks*/

for(i=0;i<=newLevel;i++){

x->forward[i]=update[i]->forward[i];

update[i]->forward[i]=x;

}

returnSTATUS_OK;

}

配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
boostasio 异步 tcp 通讯 粘包解包 解决方案
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:boostasio异步tcp通讯及tcp粘包解包解决方案.docx
链接地址:https://www.bdocx.com/doc/11853912.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开