inet_addr |
Prototype: |
#include <arpa/inet.h>
unsigned long int inet_addr(const char *ip_address);
|
General Description: |
A deprecated conversion tool for converting numeric, dot-notation addresses into the network-byte-order binary form. If it fails, the return value (-1 or 255.255.255.255) is still a legal address. The inet_aton() tool has better error handling. |
Return Value: |
NONZERO if everything goes well. The value is the converted IP address. The call returns INADDR_NONE (-1) if the parameter is not valid. |
Parameters |
ip_address |
The human-readable, dot-notation form (for example, 128.187.34.2). |
Possible Errors |
(errno not set) |
|
|
Examples |
if ( (addr.sin_addr.s_addr = inet_addr("128.187.34.2")) == 0 )
perror("Couldn't convert address");
|