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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Storing Perl Socket Object to MySQL Table

 



kirtimaan
New User

Jul 2, 2008, 3:47 AM

Post #1 of 3 (440 views)
Storing Perl Socket Object to MySQL Table Can't Post

Hello,

I am working on a perl script which uses IO::Select and IO::Socket modules.

When a client connect to perl program, perl program need to send message to some other clients who are already connected. So far I am using a method by creating an array of such client's socket handle (fileno). Then using a loop for all connected clients while checking if perl program has to send message to that socket handle or not.

Now what I am thinking that if I can place whole socket object for each connected client into a mysql table and then use that table to get target client's socket handle, I can speed up things as well free some memory.

However, I am not sure how I can have whole socket object into mysql table. I use DBI to access mysql table.

Thanks.


meloyelo
User

Jul 3, 2008, 7:05 PM

Post #2 of 3 (400 views)
Re: [kirtimaan] Storing Perl Socket Object to MySQL Table [In reply to] Can't Post

Sorry, but you can't store a socket in a mysql table.

You won't speed things up by doing that anyway. Getting something from a database takes orders of magnitude more time than getting it from memory. It takes at least 1000 times longer.


kirtimaan
New User

Jul 3, 2008, 9:44 PM

Post #3 of 3 (394 views)
Re: [meloyelo] Storing Perl Socket Object to MySQL Table [In reply to] Can't Post

Thanks for your reply. So, only option is using a hash to store socket references and then use that instead of using the database table.

One thing, I am using CGI::Session module. So perhaps I can use that to store socket object. That module use a MySQL table to store the persistent data, so not sure if that will allow saving socket object. But I can give that a try.

I will post results here.

Thanks, Kirtimaan

 
 


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

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