Skip to main content
Visitor II
June 12, 2023
Solved

Which port number for TCP ethernet communication?

  • June 12, 2023
  • 1 reply
  • 2057 views

I am using an stm32h23zg, FreeRTOS plus TCP stack to create a TCP client.

I checked, I can bind the socket to many values (tried 1, 52 and 1000, all 3 worked) but I couldn't find any recommendation on which port to use.

On computers it is usually recommended to use ports over 50000 as they are specificaly made for "free use" (while the previous ones have a specific use and shouldn't be touched by a lmabda user).

I looked only. no results.

This guide uses port 7 : https://www.youtube.com/watch?v=KXS7HqmcWpk

This guide uses port 5000 : https://www.carminenoviello.com/2015/08/28/adding-ethernet-connectivity-stm32-nucleo/

Is there any recommendation on which port number to use for a TCP connection?

    This topic has been closed for replies.
    Best answer by TDK

    It's really up to you. Usually it's best to avoid common ports (e.g. 80 for HTTP) since they may be in use already by the remote device.

    https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

    1 reply

    TDKAnswer
    Super User
    June 12, 2023

    It's really up to you. Usually it's best to avoid common ports (e.g. 80 for HTTP) since they may be in use already by the remote device.

    https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers