MSDN Documentation

Networking & Internet APIs

The Windows Networking APIs provide developers with the tools needed to create robust network-enabled applications. This section covers core APIs such as Winsock, HTTP services, FTP, DNS, and security protocols.

Winsock
HTTP Services
FTP
DNS
Security (SCHANNEL)

Winsock (Windows Sockets)

Winsock provides a standard TCP/IP and UDP networking interface for Windows applications.

#include <winsock2.h>
#pragma comment(lib, "Ws2_32.lib")

int main() {
    WSADATA wsaData;
    if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
        return 1;
    }
    // socket creation, connection, etc.
    WSACleanup();
    return 0;
}

HTTP Services (WinHTTP & WinInet)

WinHTTP and WinInet simplify HTTP client development.

#include <winhttp.h>
#pragma comment(lib, "winhttp.lib")

int main() {
    HINTERNET hSession = WinHttpOpen(L"Sample/1.0", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, NULL, NULL, 0);
    // more code...
    WinHttpCloseHandle(hSession);
    return 0;
}

FTP Functions

FTP support via WinInet functions for file transfer operations.

DNS APIs

Retrieve DNS information using DnsQuery, DnsRecordListFree, and related functions.

#include <windns.h>
#pragma comment(lib, "dnsapi.lib")

int main() {
    PDNS_RECORD pRecord;
    if (DnsQuery_W(L"example.com", DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &pRecord, NULL) == 0) {
        // process record
        DnsRecordListFree(pRecord, DnsFreeRecordList);
    }
    return 0;
}

Security (SCHANNEL)

SCHANNEL provides TLS/SSL protocols for secure communications.