Eathernet2 EathernetUdp2 compile errors

Hi All,

I have been trying to get the below EathernetUdp code to compile, and no matter what I have tried from researching the forums, and every where else I could find, I cant get any code that calls the EathernetUdp2 code to compile. Eathernet2 server / Client code compiles just fine if the #include EathernetUdp2 is not there.

I get some variation of the below errors, or other errors.

I am Trying to down load the information from this little Jewel:

with the PM-101-CE Ethernet Computer Interface.

This is the relevant Tec Doc for interfacing with the Pentametric.
http://www.bogartengineering.com/wp-content/uploads/docs/PentaMetricRS232SerialSpecWeb6-11.pdf

This code is based on various examples that I have put together to do what I think the pentametric needs, and some of it will be stripped out, and other bits added......
Thing is, I am not even sure that the UPD format is the correct way to access the data in the pentametric or not..... Was gonna try, but the compile errors have stymied that effort.
there may be other Library's that would do this better/easier.

Thanks for any help on this issue, as I see others with similar problems with EathernetUDP2, but have not found any answers that fixed it.

...............................Errors........................
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void setup()':

Pentametric_Coms:40: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


   Udp.begin(LocalPort);

   ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: At global scope:

Pentametric_Coms:48: error: expected unqualified-id before '=' token

  EthernetUDP = Udp;// To send & receive packets using UDP

              ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void ProcessUDPTraffic()':

Pentametric_Coms:64: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


   int nPacketSize = Udp.parsePacket();

                     ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void SendADCData()':

Pentametric_Coms:97: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


       Udp.beginPacket(DestinationAddress, DestinationPort);

       ^

exit status 1
The Udp class has been renamed EthernetUdp.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
.............................................Code............................................
#include <SPI.h>
#include <Ethernet2.h>
#include <EthernetUdp2.h>
//#include <Udp.h>
#include <EthernetUdp2.cpp>

// ------------------------------------------------------------------
// Configuration

// The mac address is the physical address associated with the
// Ethernet port on the your device. It should be globally unique if
// the board is connected to a public network, or at least locally
// unique if the board is connected to a private network.
byte MacAddress[] = { 0x90, 0xA2, 0xDA, 0x10, 0xA3, 0x4F };
//byte MacAddress[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// The IP address is the internet protocol address for the board. Again
// it should be globally unique if connected to a public network or
// locally unique if connected to a private network. To communicate
// successfully, it should also be on the same sub-net as your PC.
// In practice that means the first three numbers should be the same
// as your PC's IP address. And the last number should be different to
// all devices on your network. Use ipconfig to find out your PC's IP address
IPAddress MyIPAddress(192, 168, 1, 165);
unsigned int LocalPort = 8888; //what would a port for the uno be?

// The destination address is the IP address of the computer you want to send
// messages to. It would normally be on the same sub-net as the Arduino. In practice
// this means the first three numbers of MyIPAddress and DestinationAddress should
// be the same.
IPAddress DestinationAddress(169, 254, 1, 1);
unsigned int DestinationPort = 1701;
//EthernetUDP2 = Ethernet2Udp;
// ------------------------------------------------------------------
// Setup
void setup()
{
  // Start ethernet and udp
  Ethernet.begin(MacAddress, MyIPAddress);
  Udp.begin(LocalPort);

  // Start RS232 comms
  Serial.begin(9600);
}

// ------------------------------------------------------------------
// Communications
 EthernetUDP = Udp;// To send & receive packets using UDP

char PacketBuffer[UDP_TX_PACKET_MAX_SIZE]; // Space to hold messages we receive.

unsigned long LastSend = 0; // Last time we sent a message
const long SendPeriod = 1000; // Time between sending messages [milliseconds]

// ------------------------------------------------------------------
// Data
bool EnableADCSend[] = { true, false, false, false, false, false, false, false };
// This Code will get changed when I can compile the code

// ------------------------------------------------------------------
// Functions
void ProcessUDPTraffic()
{
  // See if there is any data available and read it.
  int nPacketSize = Udp.parsePacket();
  if (nPacketSize > 0)
  {
    int nRead = Udp.read(PacketBuffer, sizeof(PacketBuffer));
    if (nRead >= 1)
    {
      int nPort = PacketBuffer[0] - '0';
      if (nPort >= 0 && nPort < sizeof(EnableADCSend))
      {
        // Toggle sending data from the specified port.
        EnableADCSend[nPort] = !EnableADCSend[nPort];

        Serial.print("Sending adc data for channel ");
        Serial.print(nPort);
        Serial.print(" is ");
        Serial.println(EnableADCSend[nPort] ? "on" : "off");
      }
    }
  }
}

void SendADCData()
{
  if (millis() - LastSend < SendPeriod)
    return;

  LastSend = millis();

  for (int iPort = 0; iPort < sizeof(EnableADCSend); ++iPort)
  {
    if (EnableADCSend[iPort])
    {
      int nValue = analogRead(iPort);
      Udp.beginPacket(DestinationAddress, DestinationPort);
      Udp.send(81, DestinationAddress, DestinationPort );   // the message to send to get BV
      Udp.send(01, DestinationAddress, DestinationPort );   //
      Udp.send(02, DestinationAddress, DestinationPort );   //
      Udp.send(7B, DestinationAddress, DestinationPort );   //  The 7B gives a error too, needs fixing
      Udp.endPacket();
    }
  }
}

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

CCing @232 because I know they love code tags:

232:

The solution to the errors you got is to change this line:

EthernetUDP = Udp;// To send & receive packets using UDP

to:

EthernetUDP Udp;// To send & receive packets using UDP

Next you will encounter some new errors about Udp.send(). There is no such function. I recommend you to start with File > Examples > Ethernet2 > UDPSendReceiveString, the associated tutorial:
https://www.arduino.cc/en/Tutorial/UDPSendReceiveString
and the library reference:

Note that you send UDP packets in a three part process. First Udp.beginPacket(), then Udp.write(), then Udp.endPacket().

Hi,

Thanks for answering...

Fixed the issue....................

The = was a Remanent from trying everything I could think of.... Fixed that, and still get the same errors as always.....

File > Examples > Ethernet2 > UDPSendReceiveString, the associated tutorial:

Been here, done this, and still have errors.....

Not 1 bit of code I have tried from any source that has the #include EathernetUpd2 statement in it, will compile without errors of one kind or another...... I currently have 6 different Ardurio IDE windows open with the various versions of UDP code I have found to try..... almost all of it is for the old Ethernet shield, needing modified for the Eathernet2 shield, and very little for the Ethernetnet2 shield

RS_:
The = was a Remanent from trying everything I could think of.... Fixed that, and still get the same errors as always.....

Actually you get less of the same errors. I forgot to say that you need to move the line:

EthernetUDP Udp;// To send & receive packets using UDP

above setup().

After that you will get no more of the "The Udp class has been renamed EthernetUdp." errors and you will be able to move on to your Udp.send() errors.

RS_:
File > Examples > Ethernet2 > UDPSendReceiveString, the associated tutorial:

Been here, done this, and still have errors.....

Please post the errors you get when you compile File > Examples > Ethernet2 > UDPSendReceiveString.

I had tryed that above the void Setup but that did not seam to help.

you said that Udp.send() errors would be next. and you said is not valid, is this now Udp.write ...? That I saw in a Udp reference some where during my research...

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

Pentametric_Coms:33: error: 'EthernetUDP2' does not name a type

 EthernetUDP2 Ethernet2Udp;

 ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void setup()':

Pentametric_Coms:40: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


   Udp.begin(LocalPort);

   ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void ProcessUDPTraffic()':

Pentametric_Coms:64: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


   int nPacketSize = Udp.parsePacket();

                     ^

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void SendADCData()':

Pentametric_Coms:97: error: The Udp class has been renamed EthernetUdp.
As of Arduino 1.0, the Udp class in the Ethernet library has been renamed to EthernetUdp.


       Udp.beginPacket(DestinationAddress, DestinationPort);

       ^

exit status 1
'EthernetUDP2' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

UDPSendReceiveString:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:35:6: error: 'UdpClass' has not been declared

 void UdpClass::begin(uint16_t port) {

      ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'void begin(uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:36:3: error: '_port' was not declared in this scope

   _port = port;

   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:37:3: error: '_sock' was not declared in this scope

   _sock = 0; //TODO: should not be hardcoded

   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:44:10: error: 'UdpClass' has not been declared

 uint16_t UdpClass::sendPacket(uint8_t * buf, uint16_t len,  uint8_t * ip, uint16_t port){

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'uint16_t sendPacket(uint8_t*, uint16_t, uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:45:17: error: '_sock' was not declared in this scope

   return sendto(_sock,(const uint8_t *)buf,len,ip,port);

                 ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:50:10: error: 'UdpClass' has not been declared

 uint16_t UdpClass::sendPacket(const char str[], uint8_t * ip, uint16_t port){

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'uint16_t sendPacket(const char*, uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:56:17: error: '_sock' was not declared in this scope

   return sendto(_sock,(const uint8_t *)str,len,ip,port);

                 ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:60:5: error: 'UdpClass' has not been declared

 int UdpClass::available() {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int available()':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:61:10: error: 'W5500' was not declared in this scope

   return W5500.getRXReceivedSize(_sock);

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:61:34: error: '_sock' was not declared in this scope

   return W5500.getRXReceivedSize(_sock);

                                  ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:70:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(uint8_t * buf, uint16_t bufLen, uint8_t *ip, uint16_t *port) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t, uint8_t*, uint16_t*)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:79:10: error: '_sock' was not declared in this scope

     recv(_sock,tmpBuf,8);

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:115:19: error: '_sock' was not declared in this scope

   return recvfrom(_sock,buf,bufLen,ip,port);

                   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:119:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(uint8_t * buf, uint16_t len) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:122:19: error: '_sock' was not declared in this scope

   return recvfrom(_sock,buf,len,ip,port);

                   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:125:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(char * buf, uint16_t bufLen, uint8_t *ip, uint16_t &port) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:136:1: error: 'UdpClass' does not name a type

 UdpClass EthernetUdp2;

 ^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
{/Code]

You didn't follow my instructions. I didn't say anything about EthernetUDP2. I said:

pert:
I forgot to say that you need to move the line:

EthernetUDP Udp;// To send & receive packets using UDP

above setup().

Like this:

#include <SPI.h>
#include <Ethernet2.h>
#include <EthernetUdp2.h>
//#include <Udp.h>
#include <EthernetUdp2.cpp>

// ------------------------------------------------------------------
// Configuration

// The mac address is the physical address associated with the
// Ethernet port on the your device. It should be globally unique if
// the board is connected to a public network, or at least locally
// unique if the board is connected to a private network.
byte MacAddress[] = { 0x90, 0xA2, 0xDA, 0x10, 0xA3, 0x4F };
//byte MacAddress[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// The IP address is the internet protocol address for the board. Again
// it should be globally unique if connected to a public network or
// locally unique if connected to a private network. To communicate
// successfully, it should also be on the same sub-net as your PC.
// In practice that means the first three numbers should be the same
// as your PC's IP address. And the last number should be different to
// all devices on your network. Use ipconfig to find out your PC's IP address
IPAddress MyIPAddress(192, 168, 1, 165);
unsigned int LocalPort = 8888; //what would a port for the uno be?

// The destination address is the IP address of the computer you want to send
// messages to. It would normally be on the same sub-net as the Arduino. In practice
// this means the first three numbers of MyIPAddress and DestinationAddress should
// be the same.
IPAddress DestinationAddress(169, 254, 1, 1);
unsigned int DestinationPort = 1701;
//EthernetUDP2 = Ethernet2Udp;
// ------------------------------------------------------------------
// Setup
EthernetUDP Udp;// To send & receive packets using UDP
void setup()
{
  // Start ethernet and udp
  Ethernet.begin(MacAddress, MyIPAddress);
  Udp.begin(LocalPort);

  // Start RS232 comms
  Serial.begin(9600);
}

// ------------------------------------------------------------------
// Communications

char PacketBuffer[UDP_TX_PACKET_MAX_SIZE]; // Space to hold messages we receive.

unsigned long LastSend = 0; // Last time we sent a message
const long SendPeriod = 1000; // Time between sending messages [milliseconds]

// ------------------------------------------------------------------
// Data
bool EnableADCSend[] = { true, false, false, false, false, false, false, false };
// This Code will get changed when I can compile the code

// ------------------------------------------------------------------
// Functions
void ProcessUDPTraffic()
{
  // See if there is any data available and read it.
  int nPacketSize = Udp.parsePacket();
  if (nPacketSize > 0)
  {
    int nRead = Udp.read(PacketBuffer, sizeof(PacketBuffer));
    if (nRead >= 1)
    {
      int nPort = PacketBuffer[0] - '0';
      if (nPort >= 0 && nPort < sizeof(EnableADCSend))
      {
        // Toggle sending data from the specified port.
        EnableADCSend[nPort] = !EnableADCSend[nPort];

        Serial.print("Sending adc data for channel ");
        Serial.print(nPort);
        Serial.print(" is ");
        Serial.println(EnableADCSend[nPort] ? "on" : "off");
      }
    }
  }
}

void SendADCData()
{
  if (millis() - LastSend < SendPeriod)
    return;

  LastSend = millis();

  for (int iPort = 0; iPort < sizeof(EnableADCSend); ++iPort)
  {
    if (EnableADCSend[iPort])
    {
      int nValue = analogRead(iPort);
      Udp.beginPacket(DestinationAddress, DestinationPort);
      Udp.send(81, DestinationAddress, DestinationPort );   // the message to send to get BV
      Udp.send(01, DestinationAddress, DestinationPort );   //
      Udp.send(02, DestinationAddress, DestinationPort );   //
      Udp.send(7B, DestinationAddress, DestinationPort );   //  The 7B gives a error too, needs fixing
      Udp.endPacket();
    }
  }
}

RS_:
you said that Udp.send() errors would be next. and you said is not valid, is this now Udp.write ...? That I saw in a Udp reference some where during my research...

I'm not aware of any analog to this Udp.send(). I'm not sure where you dug that up. As I said before:

pert:
I recommend you to start with File > Examples > Ethernet2 > UDPSendReceiveString, the associated tutorial:
https://www.arduino.cc/en/Tutorial/UDPSendReceiveString
and the library reference:
Ethernet - Arduino Reference
Note that you send UDP packets in a three part process. First Udp.beginPacket(), then Udp.write(), then Udp.endPacket().

If you study the example code and the reference pages for Udp.beginPacket(), then Udp.write(), then Udp.endPacket() you'll understand.

RS_:
UDPSendReceiveString:

It seems you're using either a very outdated or a modified version of the Ethernet2 library. Please provide a link to where you got that library from. Since it's modified, I suppose there is a chance it does have a Udp.send() function. I'd need to look at the library to see.

OK Sorry, I missed the deference, been staring at all this for 3 days....

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\RS\Documents\Arduino\Pentametric_Coms\Pentametric_Coms.ino: In function 'void SendADCData()':

Pentametric_Coms:98: error: 'class EthernetUDP' has no member named 'send'

       Udp.send(81, DestinationAddress, DestinationPort );   // the message to send to get BV

           ^

Pentametric_Coms:99: error: 'class EthernetUDP' has no member named 'send'

       Udp.send(01, DestinationAddress, DestinationPort );   //

           ^

Pentametric_Coms:100: error: 'class EthernetUDP' has no member named 'send'

       Udp.send(02, DestinationAddress, DestinationPort );   //

           ^

Pentametric_Coms:101: error: 'class EthernetUDP' has no member named 'send'

       Udp.send(77, DestinationAddress, DestinationPort );   //

           ^

exit status 1
'class EthernetUDP' has no member named 'send'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

this is the version on my IDE eathernet2 Library.

/*
  UDPSendReceive.pde:
 This sketch receives UDP message strings, prints them to the serial port
 and sends an "acknowledge" string back to the sender

 A Processing sketch is included at the end of file that can be used to send
 and received messages for testing with a computer.

 created 21 Aug 2010
 by Michael Margolis

 This code is in the public domain.
 */


#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet2.h>
#include <EthernetUdp2.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008


// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);

unsigned int localPort = 8888;      // local port to listen on

// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
char  ReplyBuffer[] = "acknowledged";       // a string to send back

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

void setup() {
  // start the Ethernet and UDP:
  Ethernet.begin(mac, ip);
  Udp.begin(localPort);

  Serial.begin(9600);
}

void loop() {
  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if (packetSize)
  {
    Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remote = Udp.remoteIP();
    for (int i = 0; i < 4; i++)
    {
      Serial.print(remote[i], DEC);
      if (i < 3)
      {
        Serial.print(".");
      }
    }
    Serial.print(", port ");
    Serial.println(Udp.remotePort());

    // read the packet into packetBufffer
    Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
    Serial.println("Contents:");
    Serial.println(packetBuffer);

    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    Udp.write(ReplyBuffer);
    Udp.endPacket();
  }
  delay(10);
}

Errors

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:35:6: error: 'UdpClass' has not been declared

 void UdpClass::begin(uint16_t port) {

      ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'void begin(uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:36:3: error: '_port' was not declared in this scope

   _port = port;

   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:37:3: error: '_sock' was not declared in this scope

   _sock = 0; //TODO: should not be hardcoded

   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:44:10: error: 'UdpClass' has not been declared

 uint16_t UdpClass::sendPacket(uint8_t * buf, uint16_t len,  uint8_t * ip, uint16_t port){

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'uint16_t sendPacket(uint8_t*, uint16_t, uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:45:17: error: '_sock' was not declared in this scope

   return sendto(_sock,(const uint8_t *)buf,len,ip,port);

                 ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:50:10: error: 'UdpClass' has not been declared

 uint16_t UdpClass::sendPacket(const char str[], uint8_t * ip, uint16_t port){

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'uint16_t sendPacket(const char*, uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:56:17: error: '_sock' was not declared in this scope

   return sendto(_sock,(const uint8_t *)str,len,ip,port);

                 ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:60:5: error: 'UdpClass' has not been declared

 int UdpClass::available() {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int available()':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:61:10: error: 'W5500' was not declared in this scope

   return W5500.getRXReceivedSize(_sock);

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:61:34: error: '_sock' was not declared in this scope

   return W5500.getRXReceivedSize(_sock);

                                  ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:70:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(uint8_t * buf, uint16_t bufLen, uint8_t *ip, uint16_t *port) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t, uint8_t*, uint16_t*)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:79:10: error: '_sock' was not declared in this scope

     recv(_sock,tmpBuf,8);

          ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:115:19: error: '_sock' was not declared in this scope

   return recvfrom(_sock,buf,bufLen,ip,port);

                   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:119:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(uint8_t * buf, uint16_t len) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: In function 'int readPacket(uint8_t*, uint16_t)':

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:122:19: error: '_sock' was not declared in this scope

   return recvfrom(_sock,buf,len,ip,port);

                   ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp: At global scope:

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:125:5: error: 'UdpClass' has not been declared

 int UdpClass::readPacket(char * buf, uint16_t bufLen, uint8_t *ip, uint16_t &port) {

     ^

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:136:1: error: 'UdpClass' does not name a type

 UdpClass EthernetUdp2;

 ^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

...and there's the errors related to Udp.send(), just as I expected. So your version of the Ethernet2 library also doesn't have that function.

You still haven't provided the information I requested:

pert:
Please provide a link to where you got that library from.

I am not sure where that old send code came from after 3 days of searching and trying everything i could find... I was trying to use code snippets from various sources to create the functionality i needed, until i solved the compile problems.....

does not matter....... after looking over the new code i see the Udp.write()
will change the relevent code in my OP...

Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write(ReplyBuffer);
Udp.endPacket();

there were so may other errors, this one just was one more error, i could not fix

if i can get anything to compile, i think i can adapt it to what i want it to do (retrieving the data from the pentametric)

And still you didn't answer my question:

pert:
Please provide a link to where you got that library from.

If you want my help then you need to provide the information I ask for. I'll not reply further until you cooperate.

RS_:
will change the relevent code in my OP...

Don't do that! That just confuses the whole thread. If you have updated code then post it as a reply.

OK, after looking through all the examples I have, I have realized that the send code came from a Processing Program's C code that runs on a PC to talk with the Ethernet shield EthernetUdp.

Various versions of this Processing Program's C code are at the bottom of most of the Udp examples. No wander it does not work. It took a lot of research just to find out that the Processing example was NOT Adrunio code, but I had already used that snippet before I found that out, because it looked like what I wanted to do.

My Ethernet2 Library came up in the Library manager and was installed from there.
which other Library might you be referring to...?

/**
 * (./) udp.pde - how to use UDP library as unicast connection
 * (cc) 2006, Cousot stephane for The Atelier Hypermedia
 * (->) http://hypermedia.loeil.org/processing/
 *
 * Create a communication between Processing<->Pure Data @ http://puredata.info/
 * This program also requires to run a small program on Pd to exchange data  
 * (hum!!! for a complete experimentation), you can find the related Pd patch
 * at http://hypermedia.loeil.org/processing/udp.pd
 * 
 * -- note that all Pd input/output messages are completed with the characters 
 * ";\n". Don't refer to this notation for a normal use. --
 */

// import UDP library
//import hypermedia.net.*;
#include <udp.h>

//UDP udp;  // define the UDP object

/**
 * init
 */
void setup() {

  // create a new datagram connection on port 6000
  // and wait for incomming message
  udp = new UDP( this, 6000 );
  //udp.log( true );     // <-- printout the connection activity
  udp.listen( true );
}

//process events
void draw() {;}

Different example.......

#include <Esplora.h>


//     Processing sketch to run with this example
// =====================================================

 /*
  Processing sketch to run with this example
 =====================================================

 // Processing UDP example to send and receive string data from Arduino
 // press any key to send the "Hello Arduino" message


 import hypermedia.net.*;

 UDP udp;  // define the UDP object


 void setup() {
 udp = new UDP( this, 6000 );  // create a new datagram connection on port 6000
 //udp.log( true ); 		// <-- printout the connection activity
 udp.listen( true );           // and wait for incoming message
 }

 void draw()
 {
 }

 void keyPressed() {
 String ip       = "192.168.1.177";	// the remote IP address
 int port        = 8888;		// the destination port

 udp.send("Hello World", ip, port );   // the message to send

 }

 void receive( byte[] data ) { 			// <-- default handler
 //void receive( byte[] data, String ip, int port ) {	// <-- extended handler

 for(int i=0; i < data.length; i++)
 print(char(data[i]));
 println();
 }
 */

RS_:
My Ethernet2 Library came up in the Library manager and was installed from there.
which other Library might you be referring to...?

Mine also came from Library Manager. But here's the problem. Your error messages you posted from the UDPSendReceive example:

RS_:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp:35:6: error: 'UdpClass' has not been declared

void UdpClass::begin(uint16_t port) {

^

shows you have a file in the Ethernet2 library installation:
C:\Users\RS\Documents\Arduino\libraries\Ethernet2\src\Udp.cpp
but the Ethernet2 library does not have a file of this name, as you can see here:

That's the directory listing of the latest release of Ethernet2 available from Library Manager but all of the other releases also don't have that file.

So it appears you have modified your Ethernet2 library and broken it. You should delete the folder C:\Users\RS\Documents\Arduino\libraries\Ethernet2 and then use Library Manager to reinstall the Ethernet2 library.

Hi,

After reinstalling the Ethernet2 Library, it will now compile...

Some how I messed it up...

If I understand what this UDPSendReceive.pde: example does, it works backwords to what i need it to do.
Where the PC Processing C code example, does more like what I want it to do......

I need it to write a retrieve command, then receive the requested data.. Then forward the Data to the PCcoms PC program that normally requests the data, when it requests the data from the Adruino Shield/UNO, and then Process the data to accomplish my project goals....

Thanks /Pert for the help with the EthernetUdp2 problems......

Now to get it to do what I started out to do.....