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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.