TCP Client
使用WiFiClient类可以实现TCP Client
基本方法
- 连接Server,connect
- 检测客户端是否存在数据流
- 读取客户端的一个字符
- 检查连接状态
使用网络串口工具,创建一个tcp server供该设备进行连接,可实现每十秒向服务端发送字符串"Hello from Arduino!",并且能够接受服务端发送的字符串并显示到串口
缺点:如果发送的间隔过短,可能出现同时输出两次字符串的情况
使用WiFiClient类可以实现TCP Client
使用网络串口工具,创建一个tcp server供该设备进行连接,可实现每十秒向服务端发送字符串"Hello from Arduino!",并且能够接受服务端发送的字符串并显示到串口
缺点:如果发送的间隔过短,可能出现同时输出两次字符串的情况