Hi @GaetanGodart,
Any success or new findings? I was unable to take a deeper look today into your code - but a good suggestion for debugging this on your end is to use Wireshark. If your device and host machine are connected to your LAN, you should be able to sniff packets sent from your device to your host machine.
Since you are using DHCP I can already tell that your device is able to talk to your router as your router assigns you your IP - that’s good!
Ok so since that’s already verified, you can sniff for packets sent to and from your device as seen by your host machine by using Wireshark with the filter ip.addr == your_device_ip. If you don’t see these packets - that would indicate that your router is not routing the packets your device sent to your host machine for whatever reason (device is sending to wrong IP would be the biggest one but I don’t think this applies here) or you might have selected the wrong network interface to sniff with Wireshark.
The reason I don’t think your device is sending to the wrong IP is because your python example showed that you were connecting to that IP (though, keep in mind that having your host machine connect to itself, even if using the IP address assigned by the router to connect, usually just has the host machine use a loopback (think localhost) rather than sending to and from the router - this isn’t super important to this but small tidbit).
If you don’t see any packets from above, the next thing to check would be to sniff for any ARP requests made by the device with the filter ( arp.src.proto_ipv4 == your_device_ip ) && ( arp.opcode==1 ) - you should see messages with Who has your_host_machine_ip? Tell your_device_ip - if you don’t see those that would be very strange as ARP requests are broadcasted and I can see at least in approach 1 that FreeRTOS-Plus-TCP makes an ARP request for your host machine’s IP.
But if you do see packets from the ip.addr filter with none of them coming from your machine (source of all packets is device ip - none with source as host machine ip) you probably just need to disable your firewall for your server port - thats more than likely the issue now that I think about it. Have you tried connecting another host machine to your LAN and running the python client to connect to your server - if this fails to connect that would be a clear indicator of a firewall issue.
Oh one last thing - remember to start sniffing packets with Wireshark and then power on your device.
Best,
Jason Carroll