I usually find answers to my problems without having to reach out and ask however this one has got me stumped.
Firstly... I am using up to date versions of Arduino IDE and Processing on a Mac running 10.8.5.
I am trying to set up an Arduino Uno R3 to send messages via UDP with an Ethernet shield R3 (Wiznet W5100). I had some trouble with this so stepped back to working with the example files provided with the UDP library (originally Hypermedia.net). The example does not work fully for me. I have found other examples on the forums where people are having similar problems but not exactly the same.
Basically.... The Arduino receives the UDP message from the Processing sketch. It then sends its text via serial to the Arduino serial monitor all good. It however does NOT then send the "acknowledged" UDP message back to processing. The tx light is flashing so I assumed something is being sent out....
I have tried the connection with PacketSender and Wireshark and do not seem to be getting the UDP message back on these either....
The code is just the code within the example file....
Any advice here would be greatly appreciated... Apologies in advance if my forum etiquette is bad... this is a first for me.
// send a reply, to the IP address and port that sent us the packet we received
if(Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()) == 0) Serial.println("beginPacket failed");
Udp.write(ReplyBuffer);
if(Udp.endPacket() == 0) Serial.println("reply send failed");
Udp.beginPacket will fail if there is a problem with the destination IP or port.
Udp.endPacket will fail if the first device en route to the destination does not accept the packet.
Ok...Firstly, thank you SurferTim for your help... I have tried the above error checking code and it is showing that the problem seems to be with Udp.endPacket. Could you please possibly suggest what I might need to change within the network settings? Do the netmask and gateway need to be specified within Ethernet.begin to be the same as on the host computer?......Or am I completely lost? .... :-/
Put the Serial.println(Ethernet.subnetMask()); etc code in to the other sketch and it doesn't fail.... and I am getting the IP addresses coming up in the serial monitor... They do differ from the subnet mask within System Preferences > Network Preferences.