Problem of sending UDP packet to a device belonging to another network but located within the same LAN.
Posted: Wed Sep 14, 2022 8:04 pm
Hi, I am trying to send a UDP packet from a client installed on my PC to a STM32F429ZI card using the built-in ethernet. The communication is structured as follows:
UDP packet in broadcast
Source IP: 192.168.1.100
Recipient IP: 255.255.255.255
Source port: 55192
Recipient port: 5048
Content: Specific request
The first packet is received correctly by the STM32 board which validates its content and responds with a specific response.
Response packet from STM to PC in UDP
Source IP: 192.168.1.110
Recipient IP: 192.168.1.100
Source port: 5048
Recipient port: 55192
In this configuration, everything works correctly as the packets pass through the same network.
If I put the STM32 on the 192.168.2.110/24 network it correctly receives the broadcast packet, it tells me that it correctly sends the response packet but if I check with wireshark I do not see any packets passing through the network.
I entered
<code>
int response = serverUdp.endPacket ();
if (response) {Serial1.println ("Response packet sent");
} else Serial1.println ("Reply packet NOT sent");
</code>
so I see the return of the endPacket () function and it always responds with the value 1
Other information:
- The sketch I am using is very similar to: https://www.arduino.cc/reference/en/lib ... udp.write/
- In place of the <Ethernet.h> library I have added <EthernetWebServer_STM32.h>
- I also tried to connect the PC and the STM point-to-point to exclude the network
- Another commercial device that has the same function does not give problems so I suppose there are no network problems
Is there a solution to this problem? is it possible to send packets to different IPs regardless of the IP and network that has been set to the ethernet interface?
Thank you
UDP packet in broadcast
Source IP: 192.168.1.100
Recipient IP: 255.255.255.255
Source port: 55192
Recipient port: 5048
Content: Specific request
The first packet is received correctly by the STM32 board which validates its content and responds with a specific response.
Response packet from STM to PC in UDP
Source IP: 192.168.1.110
Recipient IP: 192.168.1.100
Source port: 5048
Recipient port: 55192
In this configuration, everything works correctly as the packets pass through the same network.
If I put the STM32 on the 192.168.2.110/24 network it correctly receives the broadcast packet, it tells me that it correctly sends the response packet but if I check with wireshark I do not see any packets passing through the network.
I entered
<code>
int response = serverUdp.endPacket ();
if (response) {Serial1.println ("Response packet sent");
} else Serial1.println ("Reply packet NOT sent");
</code>
so I see the return of the endPacket () function and it always responds with the value 1
Other information:
- The sketch I am using is very similar to: https://www.arduino.cc/reference/en/lib ... udp.write/
- In place of the <Ethernet.h> library I have added <EthernetWebServer_STM32.h>
- I also tried to connect the PC and the STM point-to-point to exclude the network
- Another commercial device that has the same function does not give problems so I suppose there are no network problems
Is there a solution to this problem? is it possible to send packets to different IPs regardless of the IP and network that has been set to the ethernet interface?
Thank you