EthernetUdp.h is not working

Hi,
I am having a serious issue while using EthernetUdp.h. I want to tell you that, I found in my code that #include <EthernetUdp.h> is not working, in order to ensure my doubt, I put forward slashes and turn that line into comments e.g. //#include <EthernetUdp.h> and then i compiled the same code but got no error at all even though made to comment that header file. Then i checked the library folder of arduino IDE 1.0.5 but i found the both EthernetUdp.cpp & EthernetUdp.h files there. Now, I am desperately waiting for any reply.

Regards,
Sherazi

Are you using dhcp to get an IP from your router? That includes EthernetUdp.h.

No I am not using dhcp to get an IP. I am directly connecting Ethernet Shield with my PC (personal computer)

There is another way. You are including Ethernet.h. That includes EthernetClient.h. That includes EthernetClient.cpp. That includes Dns.h. That includes EthernetUdp.h. Whew!

Yup i checked the route you have mentioned but still i am not getting any thing @ my PC (personal computer).
I am attaching my M file that i am using to receive and send data between PC (personal computer) and arduino shield. And also the example code that i am using.

Ethernet_Comm.m (128 Bytes)

UDPSendReceiveString.ino (3.07 KB)

Are you allowing udp port 8889 through your PC firewall?

And your PC code is not waiting. Send, then immediately check for a response. The response packet may not be back yet.

First of all thanks a alot... :slight_smile:
Yup i turned off my windows firewall and then checked what happen my ethernet shield is sending out the data but i could n't able to receive this at my PC. Please do a little more help, what should be the time delay at which i can receive data packets at my PC????????

Hi,
did you solve this? I am getting the same error!
i.e. including EthernetUDP.h results in an error for the compiler, commenting it allows compiler to finish and to flash code into UNO but i cannot send/receive string from other IP.
Cheers

ccantini:
did you solve this? I am getting the same error!
i.e. including EthernetUDP.h results in an error for the compiler, commenting it allows compiler to finish and to flash code into UNO but i cannot send/receive string from other IP.

What do you mean "solve"? I have no problems with the ethernet shield and UDP. My code compiles and runs. You should post your code if you expect help on this forum.

Right!
I am refering to Sherazi who first posted here and my issue looks the same he described.
I am working on a board with sensors and trying to store data in a remote dabase.
I am using arduino ethernet w PoE and ethernet connection works fine.
Then i started testing UDP to be able to send data the sensors collect and I wanted to start dealing with UDP so the code, it is the example we can find in the website:
Ethernet - Arduino Reference.
The problem i face is that compiler works only if i comment " include EthernetUdp.h " but I receive nothing from another computer. Firewalls are disabled.
Cheers

This link has my Arduino and Linux code, and it has not failed me yet. It has the include you said makes yours fail.
http://forum.arduino.cc/index.php?topic=198259.msg1462983#msg1462983

thank you, i used your code - and like the one of the simple examples, the compiler gives errors, like it didnt find the .cpp

Arduino\libraries\only_UDP\EthernetUdp.cpp:29:19: error: w5100.h: No such file or directory
Arduino\libraries\only_UDP\EthernetUdp.cpp:30:20: error: socket.h: No such file or directory
Arduino\libraries\only_UDP\EthernetUdp.cpp: In member function 'virtual uint8_t EthernetUDP::begin(uint16_t)':
...

If I include w5100.h and socket.h compiler gives invalid conversions in the socket.cpp.
but this headers are already in the Ethernet.h and in the same folder. It looks like links are missing, right?
I know sounds really silly, but is freaking me out!
Question, did you have to download the library EthernetUDP.cpp plus its header or was it already in the folders of libraries provided by arduino IDE?

This is not the correct library. I don’t know where you got that.

Arduino\libraries*only_UDP*\EthernetUdp.cpp:29:19: error: w5100.h: No such file or directory

hey, i'm getting error too using ethernetUdp.cpp
here so many errors, and I don't know what should I do to compile the program.
In computer's my friend, he can compile that. But why in my comp can't do well? help me please :slight_smile:

C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:35: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'void begin(uint16_t)':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:36: error: '_port' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:37: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:44: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'uint16_t sendPacket(uint8_t*, uint16_t, uint8_t*, uint16_t)':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:45: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:50: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'uint16_t sendPacket(const char*, uint8_t*, uint16_t)':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:56: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:60: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'int available()':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:61: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:69: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t, uint8_t*, uint16_t*)':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:70: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:74: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t)':
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:77: error: '_sock' was not declared in this scope
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp: At global scope:
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:80: error: 'UdpClass' has not been declared
C:\Users\acer\Documents\Arduino\libraries\Ethernet\Udp.cpp:88: error: 'UdpClass' does not name a type