This error also occurs when you are not connected to the Internet, so make sure you are connected.
The most likely cause for this problem is that your firewall does not allow MSN Messenger to access the Internet. This happens often if you install a new version of Messenger. Make sure MSN Messenger is allowed access in your firewall rules. See our article on using MSN Messenger through a firewall application.
This error might also be occuring because there is a proxy server enabled in MSN Messenger while you do not use one. To remove the proxy settings, click the "Tools" menu and then "Options..." at your MSN Messenger main window. Then in the options screen click "Connection" in the list to the left. Next, click the "Advanced Settings..." button. You can try and uncheck all checkboxes in this screen except the one labeled "TCP" to let MSN Messenger connect through a direct connection. If that does not work you can restore the settings again by checking the boxes you unchecked before.