zentara,
your version
print $socket $chat[$i], $EOL if ( $1 ne $ID && $2 ne $kill);
sends the $ID to all the Clients and there it has absolutely no meaning.
The Reader adds the (internal) $ID:
push @chat, "$self->{ID}\t$1";
and the Writer should remove this ID:(little changed)
foreach ( @chat[$E{$ID} .. $#chat] ) {
# spilt into ID and incomming line
/(.+?)\s(.+)[\n\r]*/;
# send only line
print $socket $2,$EOL if ( $1 ne $ID && $2 ne $kill);
}
So a Writer does
not send
1. if a line is from its corresponding Reader:
$1 ne $22. if a line has the kill-code (no matter by whom):
$2 ne $kill
If you want the Client to get back his own line just change print $socket .. to:
print $socket $2,$EOL if ( $2 ne $kill );
Well, when I removed my stupid bug (look at the code,
a few lines above is a simular sitiation, where I
can 'empty' $Elm),
this memory access error disappeared. So I think it is from there.
In case of any problem may be you better mail me directly:
g o o l y @ g m x . a t
(valid until I get tooo much spam.)
have fun chatting,
carl
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.