6 years, 3 months ago.

Nucleo F429ZI ethernet connection defaulting to port 60680

I'm trying to connect a Nucleo F429ZI to a laptop via ethernet to have it send information back and forth between a software using UDP. I've used a UDP Sender/Receiver to test the connection and it works. The board's IP port shows up as 60680 but I never set this and do not know where it comes from. The software requires the receiving port to be a specific port, so is there anyway to manually set the port number of the board? Thanks!

1 Answer

6 years, 3 months ago.

Hi, watch the row 41

https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/UDPSocket.cpp

and watch the example of API's (UDPsocked or SockedAddress). The port can be added as parametr to sento() function or in the SocketAddress.set_port() function.

https://os.mbed.com/docs/v5.9/reference/network-socket.html

Best regards J.

This helps set where the board is sending the packets, but is there anyway to set where the board is receiving packets? When I use the udp sender/receiver the board sends from a 60680 port but I need it to receive from a 4446 port (that is where the software is sending it). I used the recvfrom () function and specified the ip and port 4446 but the board won't receive a packet at this port. When I change the udp sender/receiver to send to port 60680 (while keeping the recvfrom() function with the 4446 port) the board will then receive the packets. My question is where does this 60680 number come from and how can I change that to 4446?

posted by David Meyenberg 08 Aug 2018

I figured it out. I needed to use the bind() function to bind the socket to the port.

posted by David Meyenberg 08 Aug 2018