It depends on two things as follows:
First dependency: To open the TCP/IP sockets it required file descriptor. The number of file descriptor used in linux is limited by /proc/sys/fs/file-max value.
User can increase the limit by writing the the number in this file (Ex. echo “65535” > /proc/sys/fs/file-max).
TCP specification states that the number of ports the host can handles is defined by a 16bit number. So ideally the maximum number of TCP/IP connections is 65535.