views:

231

answers:

3

I currently use a simple winsock solution (WSAStartup, socket, connect, send, recv, closesocket) for HTTP-requests to get a 32 byte response of our own server.

Is there a performance or security reason to switch to WinHTTP or another library?

+3  A: 

The WinHTTP library provides much more functionality for the HTTP protocol other than simply using sockets. For example, it provides valid HTTP requests methods (GET, POST, PUT etc..) for you to use easily, without having to go over the HTTP protocol yourself.

Luca Matteis
+4  A: 

Ease of use, thoroughly tested, feature-enrich, error checking, etc. The only security reason I can think of is if you do it yourself and you are not experienced enough you may leave yourself open to buffer overflows or other similar exploits. Depending on your ability a 3rd party library might be more efficient and therefore faster as well.

I would recommend using a 3rd party library unless you are confident enough in your own ability.

Kane Wallmann
A: 

Portability is also a factor here. Also, other libraries have much nicer APIs than Winsock's.