1 2 3 4 5 6 7 |
struct hostent *host; struct sockaddr_in serv_addr; host = gethostbyname(argv[1])); serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(9999); serv_addr.sin_addr = *((struct in_addr *)host->h_addr); bzero(&(serv_addr.sin_zero),8); |
转载请注明:爱开源 » 有用的代码小片段1–主机名->IP