cwb C 语言网络框架开源项目

我要开发同款
匿名用户2021年05月25日
36阅读
开发技术C/C++
所属分类Web应用开发、Web框架
授权协议LGPL

作品详情

cwb(ConWeb)一个轻量级,快速的C语言网络框架。

特性:异步IO支持事件驱动库数据序列化、编码支持示例代码/*事件驱动库*/Cwb_Event_Base*base=cwb_event_new();assert(base);assert(!cwb_event_watch_fd(base,serverSocket,CWB_EVENT_READ,sockethandler,NULL));cwb_event_loop(base);cwb_event_destroy(base);/*数据结构*/#include<stdio.h>#include<stdlib.h>#include<string.h>#include<assert.h>#include<cwb/Ds.h>#include"Test.h"intmain(void){Cwb_Ds*dic=cwb_ds_new(CWB_DS_DICTIONARY,CWB_DS_SKEY);assert(dic);cwb_ds_set(dic,"I","Suote127");cwb_ds_set(dic,"you","User");cwb_ds_set(dic,"he","Unknow");puts(cwb_ds_get(dic,"he"));puts(cwb_ds_get(dic,"you"));puts(cwb_ds_get(dic,"I"));cwb_ds_set(dic,"I","Theprogrammer");puts(cwb_ds_get(dic,"I"));cwb_ds_set(dic,"you",CWB_DS_UNDEFINED);assert(cwb_ds_get(dic,"you")==CWB_DS_UNDEFINED);cwb_ds_destroy(dic);return0;}/*动态字符串*/#include<assert.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#include<cwb/Dstr.h>intmain(void){chartemp[1024];fgets(temp,1024,stdin);temp[strlen(temp)-1]='\0';Cwb_Dstr*dstr=cwb_dstr_new();assert(dstr);assert(cwb_dstr_assign(dstr,temp));Cwb_Dstr*copy=cwb_dstr_copy(dstr);char*s=cwb_dstr_convert(dstr,NULL,0);puts(s);char*t=strdup(s);cwb_dstr_appendd(dstr,&t);assert(!t);cwb_dstr_appendc(dstr,':');cwb_dstr_appendc(dstr,')');free(s);s=cwb_dstr_convert(dstr,NULL,0);puts(s);cwb_dstr_destroy(dstr);free(s);cwb_dstr_appends(copy,":)");s=cwb_dstr_convert(copy,NULL,0);puts(s);free(s);return0;}

 

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论