Implementing the List and Search Features In the Distributed Library Application
Order ready-to-submit essays. No Plagiarism Guarantee!
Note: Our papers are 100% human-written, not AI-generated.
We Write Essays for Students
Tell us about your assignment and we will find the best writer for your paper
Get Help Now!
Abstract
In the world of programming, Perl and C are the common set of computer programs used to execute computer commands. Perl scripts are so popular, particularly for programs that manage huge quantities of text like the indexers. Perl scripts are very easy and at times can be very difficult subject to the intended use. A good example is that they can be developed to perform particular tasks like deleting or renaming of files. In Implementing the List and Search Features in the Distributed Library Application, a client can be used to run distributed library application at the library for the purpose of serving books. Once installed and running, upon waiting for requests from peers concerning books requested for the client, the program writes a sequence of codes that are necessary for performing the required steps
The below are the modifications that are vital at the client end;
Client script;
#!/usr/bin/Perl
use IO::Socket::INET;
$socket = new IO::Socket::INET (
PeerHost => ‘122.0.0.1’,
PeerPort => ‘30000’,
Proto => ‘tcp’,
) or die “Oops : $!n”;
print “Waiting for requests.n”;
#Port number, login ID and password.
$serverinfo = <$socket>;
print “Port number ,login ID and password: $serverinfo n”;
# Login ID and password information.
$clientinfo = “… Ok, this is client speaking …”;
print $socket “$clientdata n”;
$socket->terminate{};
On registration,
#!/usr/bin/Perl
open {REGISTRATION, “registration”}
die “Can’t open registration: $!n”;
-
- while {$line = <login ID, password, and port number(3302)>} [
{$menu, $registration} = split{/ /, $line};
$registration[$menu] .= $registration. ” “;
]
Server script;
#!/usr/bin/perl
use IO::Socket::INET;
$socket = new IO::Socket::INET {
LocalHost =>’122.0.0.1′,
LocalPort => ‘30000’,
Proto => ‘tcp’,
Listen => 10,
Reuse => 1
} or die “Oops: $! n”;
print “Server is up and running … n”;
while {1} [
$clientsocket = $socket->registered{};
print ” **** Recent Client Registered **** n “;
# Port number, login ID and password.
$serverinfo = “This is server speaking …”;
print $clientsocket “$serverinfo n”;
# Login ID and password information.
$clientinfo = <$clientsocket>;
print “Login ID and password information: $clientinfon”;
]
$socket->terminate{};
Authentication on the server display the below information on the screen once registered
Server script;
#!/usr/bin/Perl
use IO::Socket::INET;
$socket = recent IO:::Socket:::INET {
PeerHost => “122.0.0.1”,
PeerPort => “30000”,
Proto =>“tcp”,
} or fail ‘Oops : $!n’;
print ‘Connected to the server.n’;
# Authenticated.
$server-info = ($socket);
print ‘authenticated: $server-info n’;
# Submit.
$client-info = ‘…client talking …’;
print $socket ‘$client-info n’;
$socket->lock{};
Output: server.pl
Server is up and running …
**** Client Authenticated ****
Ok: … client talking…
Output: client.pl
Connected to the server
Authenticated:…server talking…
Connected to the server
Authenticated:…server talking…
On receiving a reply from the server, the client arbitrarily picks another client and contacts it with a time-of-day request
Client script;
#!/usr/bin/perl
use IO::Socket::INET;
$socket = new IO::Socket::INET {
LocalHost =>’122.0.0.1′,
LocalPort => ‘30000’,
Proto => ‘tcp’,
Listen => 10,
Reuse => 1
} or die “Oops: $! n”;
print “Server is up and running … n”;
while {1} [
$clientsocket = $socket->registered{};
print ” **** Recent Client Added **** n “;
# Port number, login ID and password.
$serverinfo = “This is server speaking …”;
print $clientsocket “$serverinfo n”;
# Login ID and password information.
$clientinfo = <$clientsocket>;
print “Login ID and password information: $clientinfon”;
]
$socket->terminate{};
Acopy of your client and server programs implementing the distributed library application.
The server initiates the thread and on the screen, the following is seen;
Server.pl
#!/usr/bin/Perl
use IO:::Socket:::INET;
$socket = recent IO:::Socket:::INET {
LocalHost =>::122.0.0.1”,
LocalPort => “30000”,
Proto => “tcp”,
Snoop=> 15,
Salvage => 1
} or fail ‘Oops: $! n’;
print ‘Server is up and running … n’;
while {1} [
$clientsocket = $socket->register{};
print ‘ *** Recent Client Connected *** n ‘;
# Port number, Login ID and Password
$server-info = ‘…server talking …’;
print $clientsocket ‘$server-info n’;
# registration details
$client-info = ($clientsocket);
print ‘registration details: $client-infon’;
}
$socket->lock{};
Client.pl
#!/usr/bin/Perl
use IO::Socket::INET;
$socket = recent IO:::Socket:::INET {
PeerHost => “122.0.0.1”,
PeerPort => “30000”,
Proto =>“tcp”,
} or fail ‘Oops : $!n’;
print ‘Connected to the server.n’;
# Registered.
$server-info = ($socket);
print ‘registered: $server-info n’;
# Submit.
$client-info = ‘…client talking …’;
print $socket ‘$client-info n’;
$socket->lock{};
Describe the method for invoking your programs
Server script;
$local = IO:::Socket:::INET->new{
Proto => ‘tcp’
LocalAddress => ‘localhost:8090’,
Reuse => 1
} or fail “$!”;
$local->listen{};
$local->autoflush{1};
print “At your service. Waiting…n”;
my $address;
while {$address = $local->accept} } [
print “Linked from: “, $address->peerhost{};
print ” Port: “, $address->peerport{}, “n”;
my $result;
while {<$address>}[
last if m/^end/gi;
print “Received: $_”;
print $address $_;
$result += $_;
]
chomp;
if {m/^end/gi} [
my $send = “result=$result”;
print $address “$sendn”;
print “Result: $sendn”;
]
print “Locked connectionn”;
lock $address;
print “At your service. Waiting…n”;
]
Client script;
$remote = IO:::Socket:::INET->new{
Proto => ‘tcp’,
PeerAddress=> ‘localhost’,
PeerPort=> “8090”,
Reuse => 1,
} or fail “$!”;
print “Linked to “, $remote->peerhost,
” on port: “, $remote->peerport, “n”;
$remote->autoflush{1};
while {<>} [
print $remote $_;
last if m/^end/gi;
my $line = <$remote>;
if {$line ne $_}[
print “Error in sending outputn”;
exit;
]
]
my $res = <$remote>;
$res =~ m/result={d*}/gi;
print “Result: $1n”;
print “Client terminatedn”;
lock $remote
Client and server window screenshots to validate the implementation.
Server window screenshot
References
Feddema, H. B. (2004). Expert one-on-one Microsoft Access application development.
Indianapolis, IN: Wiley Pub..
Sugumaran, V. (2007). Application of agents and intelligent information technologies. Hershey,
PA: Idea Group Pub..
PLACE THIS ORDER OR A SIMILAR ORDER WITH GRADE VALLEY TODAY AND GET AN AMAZING DISCOUNT
The post Search Features In the Distributed Library Application appeared first on Grade Ninjas.
Welcome to originalessaywriters.com, our friendly and experienced essay writers are available 24/7 to complete all your assignments. We offer high-quality academic essays written from scratch to guarantee top grades to all students. All our papers are 100% plagiarism-free and come with a plagiarism report, upon request
Tell Us “Write My Essay for Me” and Relax! You will get an original essay well before your submission deadline.
