Linux API/network

INADDR_ANY/INADDR_BROADCAST/INADDR_NONE 매크로

구차니 2011. 9. 29. 18:05
/usr/include/netinet/in.h

176 /* Address to accept any incoming messages.  */
177 #define INADDR_ANY      ((in_addr_t) 0x00000000)
178 /* Address to send to all hosts.  */
179 #define INADDR_BROADCAST    ((in_addr_t) 0xffffffff)
180 /* Address indicating an error return.  */
181 #define INADDR_NONE     ((in_addr_t) 0xffffffff) 

hton() 과 같은 변환없이 사용해도 되는 매크로인데
255.255.255.255(BROADCAST/NONE) 혹은 0.0.0.0(ANY) 으로 치환이 된다.