BACKRUSH  À¯´Ð½º¸í·É  ´ÙÀ½  ÀÚ·á½Ç  Ascii Table   ¿ø°ÝÁ¢¼Ó  ´Þ·Â,½Ã°£   ÇÁ·Î¼¼½º   ½©
ÁöÇÏö³ë¼±   RFC¹®¼­   SUN FAQ   SUN FAQ1   C¸Þ´º¾ó   PHP¸Þ´º¾ó   ³Ê±¸¸®   ¾Æ½ºÅ°¿ùµå ¾ÆÀÌÇǼ­Ä¡

±Û¾´ÀÌ: huiriri [È£½ºÆ®À̸§À¸·Î ip¾Ë¾Æ³»±â] Á¶È¸¼ö: 8525

stone@backrush.com
http://www.backrush.com

# cat 1.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
int main(int argc, char *argv[])
{
struct hostent *host;
if (argc != 2) {
printf("oh~~ shit... µÎ°³¾È³ÖÀ¸¸é¾ÈµÇÁã\n");
exit(1);
}
if ((host=gethostbyname(argv[1])) == NULL) {
perror("gethostbyname");
exit(1);
}
printf("Host name : %s\n", host->h_name);
printf("IP Address : %s\n",
inet_ntoa(*((struct in_addr *)host->h_addr)));
}

¸îÁٵǾȵǴ¼ҽºÁö¸¸.. ¾öû³­ ÀÏÀ» Çس»´Â ¼Ò½º¶ø´Ï´Ù.. ^^
È£½ºÆ®À̸§À» ³Ö°Ô µÇ¸é.. ¾ÆÀÌÇǸ¦ ³»¹ñ´Â..
³×Æ®¿÷Çñ׸²ÀÇ ÃÖÃÊÁÒ.. ^^;
#include <netdb.h> À̺κÐÀ» ÁÖ¸ñÇØÁÖ¼¼¿ä...
À̺κÐÀº Çì´õÇÔ¼ö¸¦
ÂüÁ¶ÇÏ´Â ºÎºÐÀä...
Èì... ¾¾¾ð¾î¿¡ Áö½ÄÀÌ ¾øÀ¸½ÅºÐÀº.. ¸ÕÀú.. ¾¾¸¦ Àâ±â¸¦ ±Ç°íÇϸç..
³×Æ®¿÷Çñ׸²¹æÇâÀ¸·Î°¡°Ú½À´Ï´Ù.
SUN ±âÁØÀ¸·Î º¼¶§.. /usr/include °¡ Çì´õÇÔ¼öÀÇ
±âº»Àý´ë°æ·Î°¡µË´Ï´Ù.
±×·³..netdb.h¶ó´Â Çì´õÆÄÀÏÀº Àú°÷À¸·Î À̵¿À» ÇÏ¸é º¼¼öÀÖ°ÚÁÒ..
cd /usr/include;more netdb.h
À§ÀÇ Çñ׸²Àº... Àú Çì´õÇÔ¼öºÎºÐÀÇ À̺κÐÀ» »ç¿ëÇÔÀ»
È®ÀÏÇÒ¼öÀÖÀ»°ÍÀÔ´Ï´Ù.
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
½ÇÇà¹æ¹ý
cc ȤÀº gcc°¡ Á¸ÀçÇÏ´Â ½Ã½ºÅÛ¿¡ ÇÑÇÔ..
(49)# cc -o 1 1.c -lnsl -lsocket
(50)#./1 korea.com
Host name : korea.com
IP Address : 211.109.6.241
(51)#
°£´ÜÇÏÁÒ? ^^;
ÀÏ´ÜÀº ÀÌ·±°Ô ÀÖ±º¾Æ.. ÇÏ°í.. Â÷±ÙÂ÷±Ù.. Çϳª¾¿.. ŸÀÌÇÎÇغ¸¼¼¿ä..
Çì´õÇÔ¼öµÚÁö´Ùº¸¸é.. ½Ã°£´Ù°¡¹ö¸®´õ¶ó±¸¿ä.. ^^

°ü·Ã±Û : 1 °Ç ±Û¾´½Ã°£ : 2002/01/16 16:42 from 210.121.188.5

 

Á¦ ¸ñ

Á¶È¸

³¯Â¥

±Û¾´ÀÌ

[È£½ºÆ®À̸§À¸·Î ip¾Ë¾Æ³»±â]

8525

2002.01.17

huiriri


  ÆÐŶÀ» ĸÃÄÇϱâ·çƾ ¸ñ·Ïº¸±â »õ±Û ¾²±â Áö¿ì±â ÀÀ´ä±Û ¾²±â ±Û ¼öÁ¤ TCP vs UDP  
BACKRUSH  À¯´Ð½º¸í·É  ´ÙÀ½  ÀÚ·á½Ç  Ascii Table   ¿ø°ÝÁ¢¼Ó  ´Þ·Â,½Ã°£   ÇÁ·Î¼¼½º   ½©
ÁöÇÏö³ë¼±   RFC¹®¼­   SUN FAQ   SUN FAQ1   C¸Þ´º¾ó   PHP¸Þ´º¾ó   ³Ê±¸¸®   ¾Æ½ºÅ°¿ùµå ¾ÆÀÌÇǼ­Ä¡