What is Whois Client?
Submitted by: AdministratorWhois 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')
")
unless ($proto = getprotobyname('tcp'));
die("550:Cannot getservbyname($service)
")
unless ($port = getservbyname($service, 'tcp'));
die("550:Cannot gethostbyname($server)
")
unless ($iaddr = gethostbyname($server));
die("550:Cannot create socket
")
unless socket($handle, PF_INET, SOCK_STREAM, $proto);
die("550:Cannot connect($service://$server)
")
unless connect($handle, sockaddr_in($port, $iaddr));
# unbuffered I/O to that service
select($handle); $| = 1; select(STDOUT); $| = 1;
return($handle);
}
Submitted by: Administrator
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')
")
unless ($proto = getprotobyname('tcp'));
die("550:Cannot getservbyname($service)
")
unless ($port = getservbyname($service, 'tcp'));
die("550:Cannot gethostbyname($server)
")
unless ($iaddr = gethostbyname($server));
die("550:Cannot create socket
")
unless socket($handle, PF_INET, SOCK_STREAM, $proto);
die("550:Cannot connect($service://$server)
")
unless connect($handle, sockaddr_in($port, $iaddr));
# unbuffered I/O to that service
select($handle); $| = 1; select(STDOUT); $| = 1;
return($handle);
}
Submitted by: Administrator
Read Online Socket Programming Job Interview Questions And Answers
Top Socket Programming Questions
☺ | Socket Programming Interview Questions |
☺ | How does the race condition occur? |
☺ | What Is Socket? |
☺ | Socket Programming in C using TCP with Code? |
☺ | What is the difference between TCP and UDP? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |