I still don't understand your problems with telnet clients. Communicating with them is in no way hopeless, or even that difficult (IMO). Telnet clients talk the telnet protocol, if you want to talk to them you need to at least know how to ignore the specfic bits of that protocol. (Which is what my mud does currently, will get around to actually using it sometime.) It's like trying to get information from a web server, and not talking HTTP.. Crazy ;)
Here's how I ignore the telnet protocol:
sub ignore_options
{
# remove all telnet options from incoming text
# Parameter: Text
my ($text) = @_;
my $chIAC = chr(255);
my $chDONT = chr(254);
my $chDO = chr(253);
my $chWONT = chr(252);
my $chWILL = chr(251);
my $chSB = chr(250);
my $chSE = chr(240);
my $chSEND = chr(1);
my $chIS = chr(0);
my $chEOR = chr(239);
my $pos = -1;
while(($pos = index($text, $chIAC, $pos)) > -1)
{
my $nextchar = substr($text, $pos + 1, 1);
if(!length($nextchar))
{
last;
}
if($nextchar eq $chIAC)
{
substr($text, $pos, 1) = '';
$pos++;
}
elsif($nextchar =~ /($chDONT|$chDO|$chWONT|$chWILL)/)
{
substr($text, $pos, 3) = '';
}
elsif($nextchar eq $chSB)
{
my $endpos = index($text, $chSE, $pos);
substr($text, $pos, $endpos - $pos + 1) = '';
}
elsif($nextchar eq $chEOR)
{
substr($text, $pos, 2) = '';
}
else
{
substr($text, $pos, 2) = '';
}
}
return $text;
}
Still, reinvent a few wheels if you want to..
C.
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.