For Team Fortress 2 or other Steam Source games.
We were getting this error when we would try to log into the same server to play.
"Connection failed after 4 retries"
So I did an internet search and found the official answer on steam on how to fix the error when trying to play with multiple clients on a shared internet and logging into the same server.
They say to create userconfig.cfg and add the clientport 270XX to the file, but it won't work without adding an extra step.
Make file userconfig.cfg and add the following (this is my modifed version):
// 27005-27032, but not 27020
// computer 1
clientport 27005
// computer 2
//clientport 27006
Doing it this way allows me to have one file, and I can keep track of what port each computer will use.
I just comment and uncomment one line for the specifc computer. FYI, Two slashes comment out the line. Meaning, only the uncommented lines execute.
But after following the directions exactly, it did not work. Why?
Well, the steam instructions are not totally correct.
After testing and using the console command net_status to figure out what was wrong, I found the clientport was still set to default.
The solution: To get userconfig.cfg to run and actually set the clientport, you have to add to the autoexec.cfg:
exec userconfig.cfg
You could also just add the clientport to autoexec.cfg, but it would not be as flexible. See my other tips for tf2 scripting on here or ask a question in the comments.