当前位置:网站首页>硬件连接服务器 tcp通讯协议 gateway
硬件连接服务器 tcp通讯协议 gateway
2022-07-25 11:02:00 【hexiaoniao】
最近的需求坑死我了。是一个网关设备(类似路由器),有网络,也可以连接有线。还有手环,通过蓝牙连接到网关
。需求是:服务器上gateway监听网关设备。网关(就是客户端或者终端设备)和Gateway连接上了。就可以发送命令给终端了。
先本地下载Gateway,http://doc2.workerman.net/on-messsge.html
本地要装php ,然后环境变量也要加哦。别忘记

windows是没有start.php的。直接双击启动服务器。start_for_win.bat
1.插上网关。电脑连接网关网络哦
2.配置网关设备连接信息 。此处选中tcp协议。ip为本地服务器ip。端口随意配置。尽量不要8080.容易被占用。
此处端口要和Gateway 配置端口保持一致。不然连接不上哦

3.
3.start.gateway配置:最后写0.0.0.0 默认内网外网都可以访问

4.双机start_for_win.bat
效果:

代表服务已经开启了哦
4.events.php文件是处理业务代码的,自动产生。唯一的。不用定义
public static function onConnect($client_id)
$data="ADBA0001600016AB3A3ACB98A0000566313210767C00FE";//命令
Gateway::sendToClient($client_id, pack("H*",$data));pack("H*",$data)以16进制格式来发送
}
5.当客户端收到命令。会回调数据到服务器哦
public static function onMessage($client_id, $message)
{
// var_dump($client_id);
var_dump(bin2hex($message));//16进制格式转
将获取到的数据存入到数据库哦。
}
硬件的东西真的麻烦
边栏推荐
- Wiznet embedded Ethernet technology training open class (free!!!)
- Power BI----这几个技能让报表更具“逼格“
- Fillet big killer, use filter to build fillet and wave effect!
- Convert string to number
- brpc源码解析(六)—— 基础类socket详解
- Onenet platform control w5500 development board LED light
- Similarity matrix, diagonalization condition
- [MySQL learning 09]
- Information management system for typical works of urban sculpture (picture sharing system SSM)
- Hacker introductory tutorial (very detailed) from zero basic introduction to proficiency, it is enough to read this one.
猜你喜欢

Power BI----这几个技能让报表更具“逼格“

教你如何通过MCU将S2E配置为UDP的工作模式

How does the whole network display IP ownership?

【IMX6ULL笔记】--内核底层驱动初步探究

【mysql学习09】

【USB设备设计】--复合设备,双HID高速(64Byte 和 1024Byte)

任何时间,任何地点,超级侦探,认真办案!

brpc源码解析(三)—— 请求其他服务器以及往socket写数据的机制

Breadth first traversal (problems related to sequence traversal of graphs and binary trees)

How to solve the problem that "w5500 chip cannot connect to the server immediately after power failure and restart in tcp_client mode"
随机推荐
Javescript loop
程序员送给女孩子的精美礼物,H5立方体,唯美,精致,高清
W5500 is in TCP_ In server mode, you cannot Ping or communicate in the switch / router network.
Talking about Devops monitoring, how does the team choose monitoring tools?
The principle analysis of filter to solve the request parameter garbled code
Reflection reflection
Teach you how to configure S2E as the working mode of TCP server through MCU
动态规划问题03_最大子段和
Power BI----这几个技能让报表更具“逼格“
Management of software defects
JS process control
brpc源码解析(二)—— brpc收到请求的处理过程
Fillet big killer, use filter to build fillet and wave effect!
【USB设备设计】--复合设备,双HID高速(64Byte 和 1024Byte)
Introduction to shortcut keys in debug chapter
【IMX6ULL笔记】--内核底层驱动初步探究
There is no sound output problem in the headphone jack on the front panel of MSI motherboard [solved]
【MySQL 17】安装异常:Could not open file ‘/var/log/mysql/mysqld.log‘ for error logging: Permission denied
油猴脚本链接
brpc源码解析(四)—— Bthread机制