Linux
Configuring sockets values on Linux™
Decrease the time wait before closing the sockets by entering:
# echo 3 > /proc/sys/net/ipv4/tcp_fin_timeout
Sometimes systems are now configured to prevent one from using a large number of ports, check the port range and modify if required.
# cat /proc/sys/net/ipv4/ip_local_port_range
This can be increased by issuing the following command
# echo "1025 65535" > /proc/sys/net/ipv4/ip_local_port_range
To have these new values take effect you might have to do (as root)
# /etc/rc.d/init.d/network restart
If you want these new values to survive across reboots you can at them to
/etc/sysctl.conf.
# Allowed local port range net.ipv4.ip_local_port_range = 1025 65535 # net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_fin_timeout = 3