problem to send packets from arduino galileo to python client using UDP

I'm trying to open a UDP socket between arduino Galielo Gen 2 and python client . I want to send the value captured by the temperature sensor from the arduino to the client and receive back a response from the client .

Arduino Code :

#include <Ethernet.h> //Load Ethernet Library
#include <EthernetUdp.h> //Load UDP Library
#include <SPI.h> //Load the SPI Library

byte mac[] = { 0x98, 0x4F, 0xEE, 0x01, 0xF1, 0xBE };
IPAddress ip( 192,168,1,207);
//IPAddress gateway(192,168,1, 1);
//IPAddress subnet(255, 255, 255, 0);
unsigned int localPort = 5454;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];
String datReq;
int packetSize;
EthernetUDP Udp;

void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip);
Udp.begin(localPort);
delay(2000);
}

void loop() {

int sensor = analogRead (A0);
float voltage = ((sensor5.0)/1023.0);
float temp = voltage 100;
Serial.println(temp);
packetSize = Udp.parsePacket();
if(packetSize>0)
{
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
, DEC);

  • if (i < 3)*
  • {*
  • Serial.print(".");*
  • }*
  • }*
  • Serial.print(", port ");*
  • Serial.println(Udp.remotePort());*
  • Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);*
  • Serial.println("Contents:");*
  • Serial.println(packetBuffer);*
  • String datReq(packetBuffer);*
  • Udp.beginPacket(Udp.remoteIP(), Udp.remotePort() );*
  • Udp.print(temp);*
  • Udp.endPacket();*
  • }*
  • delay(50);*
    }
    Python Code :
    from socket import *
    import time
    address = ( '192.168.1.207', 5454)
    client_socket = socket(AF_INET, SOCK_DGRAM)
    client_socket.settimeout(5)
    while(1):
  • data = "Temperature"*
  • client_socket.sendto(data, address)*
  • rec_data, addr = client_socket.recvfrom(2048)*
  • print rec_data*
    After trying the code this is the result on arduino :
    Received packet of size 11 From 255.255.255.255, port 0 Contents: Temperature
    On python I got this message : Traceback (most recent call last): File "C:/Users/enwan/Desktop/te/temp.py", line 12, in rec_data, addr = client_socket.recvfrom(2048) timeout: timed out
    it seems that Arduino is trying to send to 255.255.255.255 which is not a valid IP address. It does not seem to be getting the remote IP.
    so I modified the code to address directly my python PC :
    *IPAddress remoteip(192,168,1,205); *
    Udp.beginPacket(remoteip, 5454 );
    Udp.print(temp);
    Udp.endPacket();
    But I still receive the same message on python
    Any help ?

If you expect a response, UDP is not the way to go. Why are you using UDP if you expect a response?

If you expect a response from sending the temperature, why are you reading the response and then sending the temperature?