4 Star 10 Fork 6

aeo123 / tcp_server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

更新2.2版本,消息和命令都不需要加\r\n了,支持中文

功能

1.ECHO回环模式 连接服务器服务器回复'hello',发什么回复什么

send-> 123
recv<- 123

2.组播

  • 设备加入房间后发送消息会传到房间内另外的全部设备(不包括自己)
  • 使用DTU和一个上位机就能自己调试DTU

//加入房间指令,每个设备只能加一个房间
CMD,GROUP,'name',['alias'] //name房间名称,alias设备别名(可不加)
示例:
send-> CMD,GROUP,123
recv<- Join Group:123

send-> CMD,GROUP,123,dtu  //别名dtu
recv<- Join Group:123


//离开房间,掉线自动离开
CMD,UNGROUP

//查询自己在哪个房间
CMD,QUERY

//查询房间里面全部设备
CMD,LIST

3.P2P 新建只有两个人的房间就能P2P


编译和安装

  1. 安装go语言,升级到GO1.13版本以上,编译用的1.15
  1. 安装依赖 go mod download
  2. 编译windows:build_win.bat
  3. 编译linux:build_linux.bat
  4. 编译全部:build_all.bat
  5. 启动程序需要和resource文件夹放一起; 修改端口在resources-> bootstrap.yaml-> port
    • windows启动:点击运行
    • linux启动:上传zip到服务器
    • 连接日志:logs文件夹
    //解压
    unzip tcp_server_linux_2.0.zip
    chmod 777 tcp_server_linux_2.0
    //运行
    ./tcp_server_linux_2.0
    //后台运行
    nohup ./tcp_server_linux_2.0 &
MIT License Copyright (c) 2020 aeo123 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

tcp_server透传echo 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/aeo123/tcp_server.git
git@gitee.com:aeo123/tcp_server.git
aeo123
tcp_server
tcp_server
master

搜索帮助