struct servent *se;
int i;
int port;
for (i = 1; i < 81 ; i++)
{
port = i;
se = getservbyport(port, "tcp");
if (se == NULL)
{
printf("se error \n");
}
printf("Service Name:%s \n", se->s_name);
printf("Service Port:%d \n" ,htons(se->s_port));
printf("Service proto:%s \n", se->s_proto);
}
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |