I read the documentation of Arduino Yun and how it works but still I haven't managed to read/write UDP packets through Ethernet, pass them to AVR and print/manipulate them.
I got confused and frustrated so I need to start over with a fresh mind and some guidance.
I set up a netcat listener on the same network with my Arduino Yun (for now is connected via WiFi).
I tested the communication between them (I connected to my Yun through SSH and connected to the netcat listener) and it works fine.
What I need to do is write a sketch which automatically connects to the netcat socket and reads/writes the Ethernet packets.
I use netcat because I read that it has less overhead, if there is a better way, I would like to know.
This is my code:
#include <Process.h>
Process p;
void setup() {
Bridge.begin();
SerialUSB.begin(9600);
while (!SerialUSB);
p.begin("nc");
p.addParameter("192.168.1.15 9911");
p.runAsynchronously();
}
void loop() {
while (p.available() > 0) {
char c = p.read();
SerialUSB.print(c);
}
SerialUSB.flush();
}
Executing through SSH the command "nc 192.168.1.15 9911" works fine, but it doesn't work on the above code.