作成中~
ソケット通信で利用する構造体など
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
#include <netinet/in.h>
struct sockaddr
{
sa_family_t sa_family;
char sa_data[14];
};
inet_addr() 関数は、インターネットホストのアドレス cp を、 IPv4 の数値とドットによる表記からネットワークバイトオーダでの バイナリ値へ変換して返す。
#include <netinet/in.h>
struct sockaddr_in {
sa_family_t sin_family; /* Set to AF_INET */
uint16_t sin_port; /* Port number (2 bytes in network byte order) */
struct in_addr sin_addr; /* The address */
}
struct in_addr {
uint32_t s_addr; /* The IPv4 address (4 bytes in network byte order) */
}