HttpWebRequest / WSAStartup issue

845 Views Asked by At

I have some managed C# code which is accessed on a thread from C++ through COM.

When I make an HttpWebRequest in my C# code it initially works, if I deactivate some of the code on the C++ side. However, when I reactivate all the C++ code, then my C# HttpWebRequests start failing with the error: "Either the application has not called WSAStartup, or WSAStartup failed". Which is bizarre because WSAStartup never needs calling from C#, I imagine it's hidden in the C# wrapper around the TCP stack. Does anyone have an idea what the real error could be?

EDIT: In my C++ code I have one direct call to WSAStartup() so I removed it, and now the error message has changed to "System.Net.Sockets.SocketException: An operation was attempted on something that is not a socket".

0

There are 0 best solutions below