libevent
Jacky_Lu
这个作者很懒,什么都没留下…
展开
-
使用 LibEvent 创建回显服务器代码
在 Ubuntu 的环境上进行编译运行,先要安装 libevent 的库,然后将生成的 软件上传到 阿里云上面, 在阿里云的管理后台打开相应的端口,在客户端使用 网络调试助手 发送数据,成功回显 代码如下: #include <stdio.h> #include <event.h> #include <arpa/inet.h> #include <event2/listener.h> void CliReadCb(struct bufferevent.原创 2022-02-06 17:28:32 · 1120 阅读 · 0 评论 -
Nodejs net 接受包 并解码,第一次使用了 protobuf
第一次使用 net 模块的 buffer 类型 对 buffer.copy 开始不了解 走了弯路,调用的对象是 sourece 一直以为是 dest 对包进行分割 包的结构为 :包内容长度[byte0 byte1] 包内容(protobuf arry)[byte2,byte3 ...],客户端使用 libevent 做 // 将net模块 引入进来 var net = require("n...原创 2020-02-22 11:02:12 · 351 阅读 · 0 评论 -
在linux下 可以 通过 libevent 操作串口,完全当成一个网络设备
在windows 下面不能实现 因为 windows 的libevent 是针对 socket 的 linux下面是针对 设备 的 都能使用 poll 去查询 他们的状态 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #inclu...原创 2019-10-25 16:30:00 · 1338 阅读 · 0 评论