Usually, firewall is guilty for errors like the one you're having. It is also possible that the lag is too big and you are kicked out in the connection phase. Use the filter system in Battlefield 3 and choose servers that are near to your location and you will not experience such issues. Firewall needs to be disabled or configured to allow the game to communicate with servers.