Communication between two mangOH board using IoT Cards


#1

Hi every,

I’m tring to use two mangOH boards to communicate with each other, I also have two IoT Cards(Wifi/Bluetooth).

First of all I have followed the instruction from WiFi Service Plugin to set up the WiFi Service.
http://legato.io/legato-docs/latest/external_proj_mainpage.html

I have successfully used all of the Sample Apps including WiFi Client, WiFi Access Point, WiFi Access Point Web. Basiclly I know now how to establish the Wifi connection between two devices(for me two boards). But all of those apps didn’t mention how to customize the serial port to send the data from one IoT wifi card to the other one.

If I want to send a message like “Hi” to the other board, is that possible to wirte this sentence in the programmfile and use some API to send it or receive it? Are there any API that I can use to support this app?

Or can I use the AT command to communicate in the console arfter connecting those two board?

Need more Information.

Thx at first

Genfory


#2

Hi Genfory,

What do you mean by “how to customize the serial port to send the data …”? In fact, if you want to communicate via WiFi from one board to another one, you need to setup one board in WiFi client mode and the other board in WiFi Access Point mode. Then, when the WiFi connection is established you can use the linux netcat tool (nc) to communicate between the 2 boards via a TCP or an UDP socket.

For example:
On WiFi client side, you can send a file “file.txt” using a TCP socket on port 1337 using the following command:

cat file.txt | nc -l 1337

and on WiFi Access Point side, you can listen the TCP socket on port 1337 and save the received content in file.log file using the following command:

nc -l -p 1337 > file.log

Hope it helps.
Best Regards,

José