All: NOTE: Thank you to EM for informing me about this mailing list. I had no idea that such an atomically sliced forum existed but I'm certainly glad it does! Imagine, people gathered to discuss only Perl ithreads... Way cool. Anyhow...
The challenge: Using ithreads for TCP and UDP sockets Me: I'm probably in the advanced beginner category at this point with Perl. I'm pretty good with data structures and sockets but have never used threads before. I understand the premise but not yet the implementation. The background: - server: Mandrake v9.1 Linux box w/Perl 5.8 enabled for ithreads - client: Multiple (should scale to thousands) Java apps. running mostly on PC's - network: Public Internet - program: Large Perl program connected to a MySQL database and Apache server. The program is intended to allow for login requests on a TCP socket, receive "stayalive" messages from clients on a dedicated UDP socket and send UDP messages on a dedicated UDP socket, the peer address of which will change based on criteria establish in the main program The specific goal: Launch the TCP socket and both UDP sockets on threads spawned from the main program and keeping them open to perform on-going tasks which primarily includes passing data back to the main program for two of the sockets and sending messages from the main program for the other socket. I suspect the sockets need to stay open and not necessarily the threads but I hope to learn that during through the dialog here. I've read through perlthrtut a couple of times and walked away with an empty and uneasy feeling. In that document a reader is told that a thread must be closed before data can be passed back which seemed like a bad thing considering my sockets are intended to stay open indefinitely. I'm not too concerned with the resource overhead of ithreads at the moment since I don't think I'll need to open too many, but that could become an issue if my understanding is inaccurate. More: I've already done testing with the TCP and UDP socket functionality and that works fine over the Internet but I currently run these as parallel processes which is not ideal for my program. I've even played with ithreads a bit to get familiar with the environment, but I'm not exactly certain how to proceed with building an overall structure to meet my needs. I'm not looking for this mailing list to provide designs, I'm mainly looking for guidance on how to use Perl ithreads to accomplish my goals from a structural perspective. I want to keep this message as short as possible as not to scare away any prospective contributors, but I am very happy at any point to get into more detail on all aspects of the program. My sincerest thanks in advance for sharing your wisdom on the subject. I think it is safe to say there aren't too many ithreads gurus in the world, and I'm happy to have found some congregated together sipping fine brandy and chatting thoughtfully on the subject. Best, Steve