int finger
int finger(char *address, char *query)
Finger a host and printf result; debug info & errors go to stderr
Documentation
Finger a host and printf result; debug info & errors go to stderr. It works as follows: First, the port number of the finger service is resolved by a getservbyname call. It should be 79/TCP, which is the default value if the resolution fails.Then the host address is resolved. First we try to treat it as a www.xxx.yyy.zzzz numerical address (via inet_addr). If that fails we try a hostname lookup (via gethostbyname).Now we create a socket (socket(AF_INET, SOCK_STREAM, 0)) and connect to the host (connect(sock, (sockaddr *)&sin, sizeof(sin))).Send query with write, terminated with a <CR/LF>.Finally receive the result with read and printf it out.
- Returns:
- 0 if ok, 1 on error.
- Parameters:
-
address - Internet address of host, may be numerical or by name.
query - Query string to send to finger server, without trailing <CR/LF> sequence.
- See Also:
- RFC1288
Alphabetic index HTML hierarchy of classes or Java
DOC++