Answer:
Whois Client: This is whois, a very simple and generic whois client. This client, unlike the classic whois client, does not check for supported flags at the client side, except for -h (whois host) and -p (whois port).
The whois(1) client makes a TCP/IP connection
to the server and conducts the kind of protocol
that you would type if you where to make
a connection by hand:
[7:30am julian] whois reggers
There were 1 matches on your request.
Full Name: Quinton, Reg
Department: Info Tech Svcs
Room: NSC 214
Phone: 679-2111x(6026)
Index Key: 481800
Machine Address: reggers@julian.uuu.com
Directory Addresses: reg.quinton@uuu.com
: r.quinton@uuu.com
: reggers@uuu.com
: quinton@uuu.com
For more information try 'whois help'.
The client sends the command "reggers", the server sends back the answer and the client displays the answer received to the user. When the server is finished the connection is closed.
Sample code: whois(1) client
sub tcpopen {
use Socket; # need socket interface
my($server, $service) = @_;# args to this function
my($proto, $port, $iaddr); # local variables
my($handle)="$server::$service";
# localized obscure handle
die("550:Cannot getprotobyname('tcp')rn")
unless ($proto = getprotobyname('tcp'));
die("550:Cannot getservbyname($service)rn")
unless ($port = getservbyname($service, 'tcp'));
die("550:Cannot gethostbyname($server)rn")
unless ($iaddr = gethostbyname($server));
die("550:Cannot create socketrn")
unless socket($handle, PF_INET, SOCK_STREAM, $proto);
die("550:Cannot connect($service://$server)rn")
unless connect($handle, sockaddr_in($port, $iaddr));
# unbuffered I/O to that service
select($handle); $| = 1; select(STDOUT); $| = 1;
return($handle);
}
The whois(1) client makes a TCP/IP connection
to the server and conducts the kind of protocol
that you would type if you where to make
a connection by hand:
[7:30am julian] whois reggers
There were 1 matches on your request.
Full Name: Quinton, Reg
Department: Info Tech Svcs
Room: NSC 214
Phone: 679-2111x(6026)
Index Key: 481800
Machine Address: reggers@julian.uuu.com
Directory Addresses: reg.quinton@uuu.com
: r.quinton@uuu.com
: reggers@uuu.com
: quinton@uuu.com
For more information try 'whois help'.
The client sends the command "reggers", the server sends back the answer and the client displays the answer received to the user. When the server is finished the connection is closed.
Sample code: whois(1) client
sub tcpopen {
use Socket; # need socket interface
my($server, $service) = @_;# args to this function
my($proto, $port, $iaddr); # local variables
my($handle)="$server::$service";
# localized obscure handle
die("550:Cannot getprotobyname('tcp')rn")
unless ($proto = getprotobyname('tcp'));
die("550:Cannot getservbyname($service)rn")
unless ($port = getservbyname($service, 'tcp'));
die("550:Cannot gethostbyname($server)rn")
unless ($iaddr = gethostbyname($server));
die("550:Cannot create socketrn")
unless socket($handle, PF_INET, SOCK_STREAM, $proto);
die("550:Cannot connect($service://$server)rn")
unless connect($handle, sockaddr_in($port, $iaddr));
# unbuffered I/O to that service
select($handle); $| = 1; select(STDOUT); $| = 1;
return($handle);
}
Previous Question | Next Question |
What are basic functions of network programming interface? | How to run the WHOIS Daemon? |