1 #include <sys/types.h> 2 #include <unistd.h> 3 #include <stdio.h> 4 5 /* bsd extensions */ 6 #include <sys/uio.h> 7 #include <sys/socket.h> 8 #include <netinet/in.h> 9 #include <netdb.h> 10 11 struct servent* getservbyport(int port,char * proto)12getservbyport(int port, char *proto) 13 { 14 char buf[32]; 15 16 snprintf(buf, sizeof buf, "%d", port); 17 return getservbyname(buf, proto); 18 } 19