Here is the Arduino UDP client sketch. Change the UDPServer setting to the IP of the server running the UDP server code.
#include <SPI.h>Â Â Â Â
#include <Ethernet.h>
#include <EthernetUdp.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {Â
 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);
IPAddress gateway(192,168,2,1);
IPAddress subnet(255,255,255,0);
unsigned int UDPport = 5005;Â Â Â // local port to listen for UDP packets
IPAddress UDPServer(xx,xx,xx,xx); // UDP server
const int UDP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ UDP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
unsigned int noChange = 0;
// A UDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
unsigned long currentTime;
unsigned long secondTime;
unsigned long msPerSecond = 1000UL;
int UDPCount = 0;
void setup()
{
 Serial.begin(115200);
 pinMode(4,OUTPUT);
 digitalWrite(4,HIGH);
//Â pinMode(10,OUTPUT);
//Â digitalWrite(10,HIGH);
// start Ethernet and UDP
 Serial.print(F("Starting w5100..."));
//Â Ethernet.begin(mac,ip,gateway,gateway,subnet);
 while(!Ethernet.begin(mac)) {
  Serial.println(F("failed. Retrying in 5 seconds."));
  delay(5000);
  Serial.print(F("Starting w5100..."));
 }
 Serial.println(Ethernet.localIP());
Â
 Udp.begin(UDPport);
 delay(2000);
 currentTime=millis();
 secondTime = currentTime;
Â
 Serial.println("Ready");
}
void loop()
{
 currentTime = millis();
 getUDPpacket();
 if(currentTime - secondTime > msPerSecond) {
   byte rtnVal = Ethernet.maintain();
   switch(rtnVal) {
    case 1: Serial.println(F("\r\nDHCP renew fail"));   Â
        break;
    case 2: Serial.println(F("\r\nDHCP renew ok"));   Â
        break;
    case 3: Serial.println(F("\r\nDHCP rebind fail"));   Â
        break;
    case 4: Serial.println(F("\r\nDHCP rebind ok"));   Â
        break;
       Â
   }
  Â
    Â
   Serial.println(F("\r\nUDP send"));
   sendUDPpacket(UDPServer); // send an NTP packet to a time server
   secondTime += msPerSecond;
 }
}
unsigned int udpCount = 0;
// send an NTP request to the time server at the given address
unsigned long sendUDPpacket(IPAddress& address)
{
 udpCount++;
Â
 // set all bytes in the buffer to 0
 memset(packetBuffer, 0, UDP_PACKET_SIZE);
 sprintf((char*)packetBuffer,"Arduino count %u",udpCount);
 Udp.beginPacket(address, UDPport); //NTP requests are to port 123
 Udp.write(packetBuffer,UDP_PACKET_SIZE);
 Udp.endPacket();
}
void getUDPpacket() {
 if ( Udp.parsePacket() ) {Â
  // We've received a packet, read the data from it
  if(Udp.remoteIP() == UDPServer) {
   Serial.print(F("UDP IP OK "));
  }
  else {
   Serial.println(F("UDP IP Bad"));
   return;
  }
  if(Udp.remotePort() == UDPport) {
   Serial.println(F("Port OK"));
  }
  else {
   Serial.println(F("Port Bad"));
   return;
  }
 Â
  Udp.read(packetBuffer,UDP_PACKET_SIZE); // read the packet into the buffer
  Serial.print(F("Received: "));
  Serial.println((char*)packetBuffer);
 }
}
Here is the UDP server code written in C for a Linux OS. I can't post the Python code because it has too much confidential stuff in it to modify quickly to interface with this basic Arduino code.
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
  int sock, n, nr;
  socklen_t fromlen;
  struct sockaddr_in server;
  struct sockaddr_in from;
 Â
  sock = socket(AF_INET, SOCK_DGRAM, 0);
  if (sock < 0)
  printf("Can not create socket in server\n");
  memset(&server, 0, sizeof(struct sockaddr_in));
  server.sin_family = AF_INET;
  server.sin_port = htons(5005);
  server.sin_addr.s_addr = INADDR_ANY;
  if(bind(sock, (struct sockaddr *)&server, sizeof(server)) < 0)
   printf("Can not bind in server!\n");
  memset(&from, 0, sizeof(struct sockaddr_in));
  fromlen = sizeof(struct sockaddr_in);
 Â
 Â
  while(1) {
    int n, l1;
  unsigned char tBuf[48];
  unsigned char outBuf[48];
 Â
 Â
  fflush(stdout);
  n = recvfrom(sock, tBuf, sizeof(tBuf), 0, (struct sockaddr*) &from, &fromlen);
    if (n < 0) {
      printf("Can not receive in server!\n");
    }
    if (n == sizeof(nr)) printf("\n\nSuccess\n\n");
//Â Â Â Â l1 = ntohl(l1);
  printf("%s from IP:%s, Port:%hu\r\n",&tBuf[0],inet_ntoa(from.sin_addr), ntohs(from.sin_port));
  sprintf(outBuf,"Server: %s\0",tBuf);
  socklen_t length = sizeof(struct sockaddr_in); Â
  n = sendto(sock, outBuf, 48, 0, (const struct sockaddr *)&from, fromlen);
  if(n < 0) {
   printf("Can not send from client");
  }
  }
}