Winsock Address Family Specific APIs
This section provides details on Winsock functions and structures that are specific to particular address families. Understanding these APIs is crucial for developing network applications that interact with different network protocols.
IPv4 (AF_INET)
APIs commonly used for IPv4 networking. This includes functions for resolving hostnames, managing sockets, and sending/receiving data over IPv4.
getaddrinfo
- Resolves a protocol-independent address and service to a socket address structure.getnameinfo
- Translates a socket address structure to a protocol-independent hostname and service.inet_addr
- Translates an IPv4 dotted-decimal string to a 32-bit network format.inet_ntoa
- Translates an IPv4 network address structure to a dotted-decimal string.WSAStringToAddress
- Converts a string representation of a network address to a socket address structure.WSAAddressToString
- Converts a socket address structure to its string representation.
inet_addr
and inet_ntoa
are still widely used, getaddrinfo
and getnameinfo
are the recommended functions for their protocol-independent nature and improved IPv6 support.
IPv6 (AF_INET6)
APIs specifically designed or enhanced to support IPv6 networking. These functions handle IPv6 addresses, scopes, and the transition from IPv4 to IPv6.
getaddrinfo
- (Also applicable here) Crucial for IPv6 address resolution.getnameinfo
- (Also applicable here) For IPv6 hostname and service resolution.InetPton
- Converts a string representation of an IPv6 address to its binary form.InetNtop
- Converts an IPv6 network address structure to its string representation.WSAStringToAddress
- Can handle IPv6 string formats.WSAAddressToString
- Can handle IPv6 address structures.
Bluetooth (AF_BTH)
Functions and structures for developing applications that utilize Bluetooth networking through Winsock.
bt_closesocket
- Closes a Bluetooth socket.bt_gethostbyname
- Retrieves the address of a Bluetooth host.bt_opensocket
- Opens a Bluetooth socket.BTH_ADDR
- Structure representing a Bluetooth device address.
IrDA (AF_IRDA)
APIs for Infared Data Association networking, allowing devices to communicate over infrared links.
irda_accept
- Accepts an incoming IrDA connection.irda_bind
- Associates a local address with a socket.irda_connect
- Establishes a connection to a remote IrDA device.irda_gethostbyaddress
- Retrieves host information based on an IrDA address.irda_gethostbyname
- Retrieves address information for a named IrDA host.
Raw Sockets (AF_PACKET)
APIs for creating and managing raw network sockets, allowing direct access to network packets.
WSASocket
- Used with theAF_PACKET
address family for raw socket creation.recvfrom
/sendto
- Essential for receiving and sending raw packets.SOCK_RAW
- Socket type used withAF_PACKET
.
This section serves as a gateway to the specific implementations within Winsock for different network protocols. Refer to individual API documentation for detailed usage, parameters, and return values.