I am attempting to send data from my Arduino to my computer using the WiFi shield. However, my code is erroring out on UDP.endPacket(), and I do not understand why. Here is my code:

#include <WiFi.h>
#include <WiFiUDP.h>

int status = WL_IDLE_STATUS;
char ssid[] = "NETGEAR31"; //  your network SSID (name)
char pass[] = "oddearth926";    // your network password (use for WPA, or use as key for WEP)

char  ReplyBuffer[] = "acknowledged";       // a string to send back

WiFiUDP Udp;

void setup()
  //Initialize serial and wait for port to open:

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) 
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED)
    Serial.print("Attempting to connect to SSID: ");
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
  Serial.println("Connected to wifi");
  Serial.println("\nStarting connection to server...");

  // if you get a connection, report back via serial:

void loop() 
  IPAddress ip(10,0,0,5);
  int port = 8766;
    // send a reply, to the IP address and port that sent us the packet we received
    if(!Udp.beginPacket(ip, port))
      Serial.println(F("Failed beginning packet"));

      Serial.println(F("Failed ending packet")); 

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(" dBm");

And here is the log:

Attempting to connect to SSID: NETGEAR31
Connected to wifi
IP Address:
signal strength (RSSI):-63 dBm

Starting connection to server...
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet

It will continue to spit out "Failed ending packet" until I stop it. Any ideas?


Fixed by updating firmware on Wifi Shield.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.