cancel
Showing results for 
Search instead for 
Did you mean: 

Which port number for TCP ethernet communication?

GGODA
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Guru

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

If you feel a post has answered your question, please click "Accept as Solution".