[EMAIL PROTECTED] wrote:
> Hey,
>
> I am making an IRC bot to bridge 2 channels on different networks.
> For this I need to scan 2 sockets for data. How do I do this? This
> is how I do 1 socket:
>
> while(my $input = <$sock>)
> {
> .........
> }
>
Ah, a whole 'nother level...
So in general you are talking about multiplexing, and you are probably
best off with picking up a good book on how to do this correctly. I
would highly suggest Network Programming with Perl by Lincoln Stein. The
lowest level (that I know of) way to do this is with the select() function,
perldoc -f select
But that gets *real* hairy, real fast. You might be better off looking
into IO::Select which is standard and has a nice little example on the
doc page.
Though I agree with the other poster that suggested looking into POE and
its components, since a lot of this has already been written. POE
handles multitasking/multiplexing like a dream. If you are doing this to
learn, then kudos. If you are doing this for any other reason then this
is one wheel you don't want to reinvent.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>