A while back SharpReader stopped working. When it went hunting for updates nothing ever happened and so I gave up trying to work out what was going on after a while and chalked it up to the beta for Service Pack 2 for XP and hoped it would magically become alive once SP2 made it to release.

So all was fine until Simon Smith released a beta of an Outlook plugin, NewsLook which puts usenet groups into Outlook. It didn't work either, but this time I got an error message about an unhandled exception in the type initialiser for the .net socket class;

Unhandled Exception: System.TypeInitializationException: The type initializer for "System.Net.Sockets.Socket" threw an exception

Now add to the mix NewsGator, another Outlook plugin, this time for RSS feeds. It didn't work either.

All 3 programs were written for the .net framework, all 3 programs were attempting to connect to the internet, all failed.

So time to fire up Visual Studio, write a simple console application that attempts to create a socket and single step through it. The code is simple;

Socket sTest = null;
sTest =
  new System.Net.Sockets.Socket(
    AddressFamily.InterNetwork,
    SocketType.Stream,
    ProtocolType.Tcp);

Bang, an error;

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll

Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

How wonderfully unhelpful, especially as the code ran on the work laptop, the better half's laptop and on the mail server. Usenet was unhelpful, with accusations in certain groups of memory leaks in user code abounding. My search words got more random, until google hit Microsoft Knowledge Base Article 815209 which points to the same error when using web services. The symptoms looked the same and the cause, well, the cause is bizarre.

When you install a protocol or a network adapter on your computer, the operating system creates a protocol binding between the network adapters and the protocols that are installed on your computer. Typically, a computer can store up to 50 protocol binding details. Therefore, if the number of protocol bindings exceeds 50, and you use the IPAddress class directly or indirectly (such as when you try to add a Web reference or when you call a Web service method).

So I downloaded the enum tool for the article and there it was 51 bound protocols. Such is the joy of having a wireless card, an ethernet card, a firewire port, bluetooth network ports, all the VPN and connection sharing stuff, parallel ports, serial ports, IrDA and to round it off NetBEUI and VirtualPC installed.

Cleaning off NetBEUI reduced the number of protocol bindings down to 22, but there was still a phantom NIC floating around in the device manager, a Xircom network card which I had tried months ago to make sure it worked before letting the better half use it. Virtual PC had bound its networking support to and which didn't get deleted when the card was removed (thanks Virtual PC). I couldn't uninstall the card, Device Manager claimed it was needed. Cleaning the registry didn't help, you can't manually delete those sorts of entries. I ended up uninstalling VPC to clear it.

Finally .net sockets work again, I guess I had better start looking at remoting.

Newsgator is interesting, the Outlook integration is very nice, but it's a shame it doesn't emulate the Outlook 2003 style alerts. It also doesn't follow related links within Outlook, instead you have to pay a subscription to a web based service which, I feel, is a bit cheeky.