我开始使用C中的OLSR路由协议从头开始创建移动ad-hoc网络。从我收集的内容来看,服务器'需要在一台设备上运行,以便其他设备连接到服务器/设备上的插槽,但我们自然会连接到多台服务器。
我想播放一个'你好''任何人都可以通过wifi收听数据包(请记住,这些设备目前还不在网络上)并获得返回的“你好”的信息。从听到我们的所有设备回来的数据包。如何才能做到这一点?以及我们将如何继续与此服务器进行通信?
我当前的伪代码(在所有设备上运行)如下:
开始时:
initialise a server and a client on local device
broadcast 'hello' packet to 'servers' in range, as client <----- How can this be done?
receive returned 'hello' messages by all nodes in range to create one-step nodes
[continue with OLSR stuff]
关于消息接收:
handle data
transmit relevant data to relevant node