It's alot easier to use Net::EasyTCP. Here are a couple of snippets that I posted awhile back
Sockets-File-Upload with Net::EasyTCP. It has port passwords, usernames and logons, and is encrypted. Read the Net::EasyTCP docs for details. Now Net::EasyTCP uses IO::Select, so that means if a second client connects, while another is currently uploading, it will have to wait for the first upload to finish.(Remember the forking? This dosn't fork). Net::EasyTCP also has a "refuse connection" list, you can employ if out on the NET and some ipaddress is hacking, but not logging on. You can do something like count
logon attempts, then after 10 failures, put them in a @banned-ips list.
Also, when I wrote that snippet, there was a problem with RSA(as mentioned), but the module now has
an option to handle this:
my @nocrypt = qw(Crypt::RSA); #too slow, but more secure
#my @nocompress = qw(Compress::LZF); #just testing this feature
$server = new Net::EasyTCP(
host => $host,
mode => 'server',
port => $port,
password => $portpassword, # if asymmetric encryption
# use a port password
donotencryptwith => \@nocrypt,
# donotencrypt => 1,
I have another snippet that implements these ideas at
ztk-enchat encrypted server client
I'm not really a human, but I play one on earth.
flash japh
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.