I have a secret project that I’m putting through non functional testing at the moment. Its ftping around 600,000 files in the space of a few hours – which means its violating the 4000 sockets in 4 minutes limitation in windows.
File #4902 System.Net.Sockets.SocketException:
Only one usage of each socket address (protocol/network address/port) is normally permitted
I don’t want to have to run my application at about 1% of its available capacity.
Luckily the solution corresponds with the usual registry tweaks for windows to make it scale.
- Ensure that all sockets use the “keep-alive” (So windows can work out faster if the socket is closed)
- Push this HKLMSystemCurrentControlSetServicesTcpipParametersMaxUserPort to 65534
- Reduce the time wait HKLMSystemCurrentControlSetServicesTcpipParametersTCPTimedWaitDelay to 30 seconds
This means I can ftp 120000 files in one minute – which is much more like it.
This seems to be part of the puzzle too.
8/6/2007 7:49:38 PM LOG Made 32450 in 22 minutes (927 connections per second)
With all of the above tweaks I managed this on a windows XP machine – it threw no “Only one usage” errors