Implementation and use of HTTP server calls VC and Winsock: Ji Hong
First, incentives ---- Windows Socket API is an open, supported network programming interfaces under Windows of multiple protocols, including a collection of Berkeley Socket function calls, and important expansion for Windows. Windows Socket has become a factual standard for Windows network programming under the full support of the Multi-Company. ---- This article will introduce a WINSOCK-based HTTP client application in the VC 5.0 ring. Readers can implement other Internet common protocols (TIME, SMTP, POP3, TELNET, FTP, etc.) for this same principle based on this example. Second, a simple browser ---- I will create a simple browser to explain how to implement HTTP client applications based on Winsock-based HTTP protocol. ---- First of all I will create a help function logfile (), which writes the string passed to the string to disk files. Then create the core function of this example - httpclient (). In this core function, I will connect to the HTTP server through WINSOCK (I will use computer World Daily 168.160.224.185 in this case). When the connection is successful, send the GET command to the HTTP server to download files on the specified path (/ 99 / tips /). The downloaded data is recorded in the local disk file by helping the function logfile ().