Hi all.
I am in the process of writing a perl based server for a professor of mine (
non-homework ) and I need a little help with some of the design aspects. Please see below for details:
Homework server:
- Function: Allow students to use a perl client to connect to and submit assignments to the instructor remotely.
- Requirement: Each student must have a unique id / password combination and a personal folder for their assignments.
Here is the code so far:
# Perl client
#!/usr/bin/perl -w
use strict;
use IO::Socket::INET;
local $| = 1;
my $host = '127.0.0.1';
my $port = 8500;
my $client = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp',
Type => SOCK_STREAM,
) or die "Couldn't create client : $!\n";
#Perl server
#!/usr/bin/perl -w
use strict;
use IO::Socket::INET;
local $| = 1;
my $response;
my $port = 8500;
my $client;
my $server = new IO::Socket::INET(
LocalPort => $port,
Type => SOCK_STREAM,
Listen => 5,
Proto => 'tcp',
Reuse => 1,
) or die "Couldn't construct server on port: $port : $!\n";
$client = $server->accept();
$response = <$client>;
chomp $response;
I don't have access to a database ( at work ) yet so I was considering hard coding the id / pw combinations as constants in the server.pl file. I could fortify this application if I were to write it as a CGI program ( setting maximum uploads, etc. ) in order to guard against DOS attacks.
Any help would be greatly appreciated,
I'll post the completed code ( both client and server ) when it has been completed.
Thanks,
-Katie.