- 일반적으로 IPv4 프로토콜을 사용하는 경우 주소 체계는 AF_INET을 설정한다.
//
// Address families.
//
#define AF_UNSPEC 0 // unspecified
#define AF_UNIX 1 // local to host (pipes, portals)
#define AF_INET 2 // internetwork: UDP, TCP, etc.
#define AF_IMPLINK 3 // arpanet imp addresses
#define AF_PUP 4 // pup protocols: e.g. BSP
#define AF_CHAOS 5 // mit CHAOS protocols
#define AF_NS 6 // XEROX NS protocols
#define AF_IPX AF_NS // IPX protocols: IPX, SPX, etc.
#define AF_ISO 7 // ISO protocols
#define AF_OSI AF_ISO // OSI is ISO
#define AF_ECMA 8 // european computer manufacturers
#define AF_DATAKIT 9 // datakit protocols
#define AF_CCITT 10 // CCITT protocols, X.25 etc
#define AF_SNA 11 // IBM SNA
#define AF_DECnet 12 // DECnet
#define AF_DLI 13 // Direct data link interface
#define AF_LAT 14 // LAT
#define AF_HYLINK 15 // NSC Hyperchannel
#define AF_APPLETALK 16 // AppleTalk
#define AF_NETBIOS 17 // NetBios-style addresses
#define AF_VOICEVIEW 18 // VoiceView
#define AF_FIREFOX 19 // Protocols from Firefox
#define AF_UNKNOWN1 20 // Somebody is using this!
#define AF_BAN 21 // Banyan
#define AF_ATM 22 // Native ATM Services
#define AF_INET6 23 // Internetwork Version 6
#define AF_CLUSTER 24 // Microsoft Wolfpack
#define AF_12844 25 // IEEE 1284.4 WG AF
#define AF_IRDA 26 // IrDA
#define AF_NETDES 28 // Network Designers OSI & gateway
- 출처 :ws2def.h
- AF_INET에서 TCP용 소켓을 생성할 시에는 SOCK_STREAM을 설정한다.
- AF_INET에서 UDP용 소켓을 생성할 시에는 SOCK_DGRAM을 설정한다.
- 0의 값을 설정하면 타입에 맞는 프로토콜이 자동 선택된다.
//
// Protocols. The IPv6 defines are specified in RFC 2292.
//
typedef enum {
#if(_WIN32_WINNT >= 0x0501)
IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options
#endif//(_WIN32_WINNT >= 0x0501)
IPPROTO_ICMP = 1,
IPPROTO_IGMP = 2,
IPPROTO_GGP = 3,
#if(_WIN32_WINNT >= 0x0501)
IPPROTO_IPV4 = 4,
#endif//(_WIN32_WINNT >= 0x0501)
#if(_WIN32_WINNT >= 0x0600)
IPPROTO_ST = 5,
#endif//(_WIN32_WINNT >= 0x0600)
IPPROTO_TCP = 6,
#if(_WIN32_WINNT >= 0x0600)
IPPROTO_CBT = 7,
IPPROTO_EGP = 8,
IPPROTO_IGP = 9,
#endif//(_WIN32_WINNT >= 0x0600)
IPPROTO_PUP = 12,
IPPROTO_UDP = 17,
IPPROTO_IDP = 22,
#if(_WIN32_WINNT >= 0x0600)
IPPROTO_RDP = 27,
#endif//(_WIN32_WINNT >= 0x0600)
#if(_WIN32_WINNT >= 0x0501)
IPPROTO_IPV6 = 41, // IPv6 header
IPPROTO_ROUTING = 43, // IPv6 Routing header
IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header
IPPROTO_ESP = 50, // encapsulating security payload
IPPROTO_AH = 51, // authentication header
IPPROTO_ICMPV6 = 58, // ICMPv6
IPPROTO_NONE = 59, // IPv6 no next header
IPPROTO_DSTOPTS = 60, // IPv6 Destination options
#endif//(_WIN32_WINNT >= 0x0501)
IPPROTO_ND = 77,
#if(_WIN32_WINNT >= 0x0501)
IPPROTO_ICLFXBM = 78,
#endif//(_WIN32_WINNT >= 0x0501)
#if(_WIN32_WINNT >= 0x0600)
IPPROTO_PIM = 103,
IPPROTO_PGM = 113,
IPPROTO_L2TP = 115,
IPPROTO_SCTP = 132,
#endif//(_WIN32_WINNT >= 0x0600)
IPPROTO_RAW = 255,
IPPROTO_MAX = 256,
//
// These are reserved for internal use by Windows.
//
IPPROTO_RESERVED_RAW = 257,
IPPROTO_RESERVED_IPSEC = 258,
IPPROTO_RESERVED_IPSECOFFLOAD = 259,
IPPROTO_RESERVED_MAX = 260
} IPPROTO, *PIPROTO;
- 출처 : ws2def.h
Return value : 성공 시 생성된 소켓의 식별자(디스크립터)를 반환하고, 실패 시 INVALID_SOCKET을 반환한다. 실패에 대한 자세한 정보는 WSAGetLastError를 참고한다.