Hi,
I've googled for this information and not found much.
Probably just haven't found the right combination of
keywords.  I have a project I'm doing to learn about
IRC better.  I'm writing a bot in perl (without using
the Net::IRC or POE modules) and I can connect to the
server, join the channel I want to join, and pass
commands to the bot via the channel and direct
messages.  What I'm running into trouble with is DCC.
I want to be able to DCC chat with it and have it
repeat what I tell it via DCC into the chat room.
I have a socket set up at the beginning for
connecting to the IRC server.  This is the main
socket, but I have to open a second socket for DCC,
so I set one up if and only if the bot receives a
DCC request from $controller (me).  The problem is
that I can open this second socket, but then it's
the only socket I can communicate with until I send
a "/dcc close chat $botnick" in the channel, THEN
it repeats only the last thing it heard from the
$dccsocket.  I think this is due to blocking calls
on the sockets I'm working with, but when I tried
setting it to fcntl( $socket, O_NONBLOCKING ) (or
at least I think that's what I did, it's been a
while) it goes through the loop once then quits
instead of looping until it receives input.  Has
anyone tried this before?  Or done some other
project that required both read and write access
on 2 open sockets without that project being a server?
I found an example of using select() but it appears
to only work on server sockets.  I need something
that works with client sockets.  I'm using this
module for my sockets... IO::Socket.  I'm also
using perl 5.6.1 on cygwin on WinXP Home.  I prefer
NOT to use Net::IRC nor POE as I'm doing this project
mostly as a learning experience and I feel I wouldn't
be learning anything to resort to someone else's work.
(and the only reason I'm using IO::Socket is that I've
worked with normal sockets enough to know I can do it
already.)  If anyone needs to see the code for the
sockets, please let me know.  I'll post what I'm doing
if it's necessary.
 
Thank you for your time,
Stefan
 


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to