>>>>> "Stefan" == Stefan Johnson <[EMAIL PROTECTED]> writes:
Stefan> I've googled for this information and not found much. Stefan> Probably just haven't found the right combination of Stefan> keywords. I have a project I'm doing to learn about Stefan> IRC better. I'm writing a bot in perl (without using Stefan> the Net::IRC or POE modules) Why? Stefan> and I can connect to the Stefan> server, join the channel I want to join, and pass Stefan> commands to the bot via the channel and direct Stefan> messages. What I'm running into trouble with is DCC. Stefan> I want to be able to DCC chat with it and have it Stefan> repeat what I tell it via DCC into the chat room. Stefan> I have a socket set up at the beginning for Stefan> connecting to the IRC server. This is the main Stefan> socket, but I have to open a second socket for DCC, Stefan> so I set one up if and only if the bot receives a Stefan> DCC request from $controller (me). The problem is Stefan> that I can open this second socket, but then it's Stefan> the only socket I can communicate with until I send Stefan> a "/dcc close chat $botnick" in the channel, THEN Stefan> it repeats only the last thing it heard from the Stefan> $dccsocket. I think this is due to blocking calls Stefan> on the sockets I'm working with, but when I tried Stefan> setting it to fcntl( $socket, O_NONBLOCKING ) (or Stefan> at least I think that's what I did, it's been a Stefan> while) it goes through the loop once then quits Stefan> instead of looping until it receives input. Has Stefan> anyone tried this before? Or done some other Stefan> project that required both read and write access Stefan> on 2 open sockets without that project being a server? Most of us that have initially suffered that pain now use the higher-level modules. Hence POE and others. Stefan> I found an example of using select() but it appears Stefan> to only work on server sockets. I need something Stefan> that works with client sockets. I'm using this Stefan> module for my sockets... IO::Socket. I'm also Stefan> using perl 5.6.1 on cygwin on WinXP Home. I prefer Stefan> NOT to use Net::IRC nor POE as I'm doing this project Stefan> mostly as a learning experience and I feel I wouldn't Stefan> be learning anything to resort to someone else's work. Well, now you're learning how much of a pain it is! Class is over. :) Stefan> (and the only reason I'm using IO::Socket is that I've Stefan> worked with normal sockets enough to know I can do it Stefan> already.) If anyone needs to see the code for the Stefan> sockets, please let me know. I'll post what I'm doing Stefan> if it's necessary. It's simpler just to look at the source code of those referenced modules. Stop trying to build everything from the ground up. If you have that much spare energy, I have a dozen projects you could be doing for me. Let me know. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]