In order to fix the problem, go to Start > Control Panel > System and Security > Windows Firewall > Turn Windows Firewall on or off and check both Turn off Windows Firewall boxes:
After that, disable your antivirus firewall and navigate to the installation directory of the game. The default directory is (C:) > Program Files > Electronic Arts > Battlefield Bad Company 2. Next, you need to launch the BFBC2UPDATER.EXE file and to wait several seconds. If you have problems, I recommend you contact the developer.