CLIENT SERVER AUTHENTICATION FINAL PROJECT

profile0-MASTERGRADE
DISTRIBUTEDLIBRARYAPPLICATION-jef.docx

Running Head: IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DISTRIBUTED LIBRARY APPLICATION

IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DISTRIBUTED LIBRARY APPLICATION 11

Implementing the List and Search Features In the Distributed Library Application

Name of Student

Name of Institution

 

 

Date of submission

Implementing the List and Search Features In the Distributed Library Application

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 manages 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 the 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: $clientinfo\n"; ]    $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: $clientinfo\n"; ]    $socket->terminate{}; 

A copy 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-info\n’; }    $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 "$send\n"; print "Result: $send\n"; ] print "Locked connection\n";

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 output\n"; exit; ] ] my $res = <$remote>; $res =~ m/result={\d*}/gi; print "Result: $1\n"; print "Client terminated\n"; lock $remote

Client and server window screenshots to validate the implementation.

C:\Users\Christine\Desktop\2073_3.jpg

C:\Users\Christine\Desktop\images (2).jpg

Server window screenshot

C:\Users\Christine\Desktop\images (1).jpg

D:\Documents and Settings\Administrator\Local Settings\Temp\Temporary Directory 12 for images.zip\images\11tic..succesful server.png

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..