CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Socket Help



Mar 24, 2004, 5:03 PM

Post #1 of 2 (1079 views)
Socket Help Can't Post

Hey, I'm a public school student who's doing TCP/IP Connections Using Perl as a Science Project for the local science fair. I'm fairly good at Perl for how long I've been using it (and especially good for my age), so I've been able to code a non-multithreaded and multithreaded Server connection (Non-Multithreaded was Easy, Multithreaded took a bit more time), But I'm having a bit of a problem!

I have it so each new Connection Is assigned to a Handle consisting of an array, and each new connection is assigned to a different element in the array (like 1, 2, 3, etc...). They then go through a login process using DBM files, and once they get in the server forks off a process that loops recieving data from them.. and then continues on to allow another connection! In The Reading of the data it recieves it looks at all the connections in the connection array and sends the message to them... BUT, because this is off in a different process and loop, it's not recognizing that the array is being changed, and it stays with the array it started with, allowing connectinos to send data to only connections that occured before them...

My uncle's good at Perl and advised me to use some sort of file or database other than a type of variable within the code for the connections... but when I try to make a reference to a connection in a DBM hash, something doesnt go right, and when it tries to print to it it says "cannot print to unopened filehandle"

Any Thoughts about an alternative way to do this? or If I'm doing Referencing Wrong? Or If I should try a different type of database solution? Any help would help!

Thaumaturge / Moderator

Mar 24, 2004, 11:16 PM

Post #2 of 2 (1067 views)
Re: [SquallX7] Socket Help [In reply to] Can't Post

I think we probably need to see some code in order to help you.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives