[SOLVED] Udp.begin does NOT return when called

Hi,

First off I did the Google thing and did not find any resolution to my problem.

I am using the Arduino mega 2560(Arduino 1.6 sdk) with Ethernet shield. When my setup function executes and it calls Udp.Begin the function never returns from udp.begin.

I have a print statement before and after that indicate the return.

Before is printed out but after is never printed. if I comment out udp.begin the setup function runs to completion.

The board is connected to my local machine. See attached file for my machine ip settings.

I noticed when I launch the program in Micro visual the local area connection status in my local machine network sharing center(win 7) drops in and out but finally remains active after the program executes into setup.

I am not sure what I am doing wrong at this point.

Below is my code
Thanks!

void setup() 
{
  byte mac[] = {   0xF0, 0x1F, 0xAF, 0x52, 0x18, 0x4E };
  IPAddress ip(192, 206, 233, 41);
  byte gateway[] = { 192, 206, 233, 44 }; // internet access via router
  byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
 
  Ethernet.begin(mac, ip, gateway, gateway,subnet);
  
  Serial.print("begin good");
 
  if (Udp.begin(80))
      Serial.print("yay");
  else
       Serial.print("boo");
}

ipv4settings.gif

I am not sure what I am doing wrong at this point.

You posted a snippet of code, so here's a snippet of an answer:

You need to ...

UDP transfer doesn't usually happen on port 80. That is the http port.

Thanks for that. That isthe cause of my other problem but the first problem was I did not have my mac address set properly

It would be a good idea to change the title so it is correct - "Udp.begin does NOT return when called" - you left off the "NOT" which changes the picture somewhat.

oops. Thanks for that

gpsmikey:
It would be a good idea to change the title so it is correct - "Udp.begin does NOT return when called" - you left off the "NOT" which changes the picture somewhat.

You know I had not noticed that.