Hi,
Is it possible to use the WiFly shield to receive UDP packets like with the Ethernet shield?
Using the Ethernet shield with a Duemilanove, I was able to send and receive UDP packets by using the standard ethernet libraries and a small amount of code like this:
#include <ethernet.h>
#include <Udp.h>
void setup(){
Udp.begin(localPort); // start UDP
}
void loop(){
int packetSize = Udp.available(); // note that this includes the UDP header
if(packetSize)
{
packetSize = packetSize - 8; // subtract the 8 byte header
Udp.readPacket(echoStream,255, remoteIp, remotePort); //read the remaining packet
}
Serial.println(echoStream); //This will print the contents of the packet received.
}
The UDP.c / UDP.h files were created for use with the Ethernet shield and not the WiFly shield, so they don’t appear to work natively. I’ve tried googling this, and I get some results which state that UDP communication is supported, but I can’t find any physical examples of it being used.
Any help would be appreciated, I’m fairly new to Arduino dev, and very new to the WiFly shield so I don’t understand a great deal yet.
Thanks