试试支持 DTLS 的 FreeCoAP

FreeCoAP 是 C 语言实现的 CoAP 服务器、客户端、HTTP/CoAP 代理。FreeCoAP 支持 DTLS ,引用的是 GnuTLS 库的 DTLS 。

mingdu.zheng at gmail dot com
https://blog.csdn.net/zoomdy/article/details/80507110

系统环境是 Xubuntu 16.04,理论上其他版本的 Ubuntu 都可以。

首先安装必要的工具:

$ sudo apt update
$ sudo apt install git autoconf libtool-bin libgnutls-dev wireshark-qt

从 github 克隆 FreeCoAP:

$ git clone https://github.com/keith-cullen/FreeCoAP ~/FreeCoAP

编译 FreeCoAP:

$ cd ~/FreeCoAP
$ autoreconf --install
$ ./configure
$ make

编译 Demo:

$ cd ~/FreeCoAP/sample/time_server
$ make
$ cd ~/FreeCoAP/sample/time_client
$ make

调用 tcpdump 捕获通信数据包:

$ sudo tcpdump -i lo -w ~/dtls.pcap "udp port 5684"

打开一个新的终端,运行 Demo 的服务器:

$ cd ~/FreeCoAP/sample/time_server
$ ./time_server 0.0.0.0 5684

再打开一个新的终端,运行 Demo 的客户端

$ cd ~/FreeCoAP/sample/time_client
$ ./time_client 127.0.0.1 5684

在运行 tcpdump 命令的终端按下 Ctrl+C 结束数据包捕获,使用 wireshark 查看捕获的数据包:

$ wireshark ~/dtls.pcap

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值