printf("ho_tari\n");
Chapter 3 (address) 본문
<inet_addr.c>
#include <stdio.h>
#include <arpa/inet.h>
int main(int argc, char *argv[])
{
char *addr1="127.212.124.78"; // 0x4E7CD47F(78.124.212.127)
char *addr2="127.212.124.255";
unsigned long conv_addr=inet_addr(addr1);
if(conv_addr==INADDR_NONE)
printf("Error occured! \n");
else
printf("Network ordered integer addr: %#lx \n", conv_addr);
conv_addr=inet_addr(addr2);
if(conv_addr==INADDR_NONE)
printf("Error occureded \n");
else
printf("Network ordered integer addr: %#lx \n\n", conv_addr);
return 0;
}
<compile 결과>
'TCP IP 소켓 프로그래밍' 카테고리의 다른 글
Chapter 5 (echo_client2) (0) | 2023.10.11 |
---|---|
Chapter 4 (echo server, client 통신) (0) | 2023.10.11 |
Chapter 3 (endian) (0) | 2023.10.10 |
Chapter 1 (read, server, client 통신) (0) | 2023.10.10 |
Chapter 1 (read) (0) | 2023.10.10 |