Shammer's Philosophy

My private adversaria

2009-09-12から1日間の記事一覧

gethostbyname sample

C

gethostbyname のサンプルだが、hostent 内容出力 - Shammerismの実装をちょっと変更するだけでできた。以下の様な感じ。 #include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <netdb.h> #include <sys/time.h> #include <stdlib.h> int main(int argc, char *args[]){ if( argc == 2 ){ char *hoststri</stdlib.h></sys/time.h></netdb.h></stdio.h></netinet/in.h></arpa/inet.h>…