树莓派的丰富应用:网络通信、图像视频与音频处理
1. 树莓派网络通信基础
1.1 客户端 - 服务器通信示例
在树莓派的网络通信中,有一个简单的客户端 - 服务器通信示例。客户端发送消息 “Hello from the Client”,服务器接收后会先休眠 5 秒,然后回复 “The Server says thanks!”。以下是客户端运行的示例输出:
pi@erpi ~/exploringrpi/chp14/threadedClientServer $ ./client localhost
Starting RPi Client Example
Sending [Hello from the Client]
Received [The Server says thanks!]
End of RPi Client Example
1.2 ConnectionHandler 类定义
ConnectionHandler 类用于处理客户端连接,其定义如下:
class SocketServer; // class declaration, due to circular ref problem
// and C/C++ single definition rule.
class ConnectionHandler {
public:
// Constructor expects a reference to the server that calle
超级会员免费看
订阅专栏 解锁全文
87

被折叠的 条评论
为什么被折叠?



