Perhaps you can put a System V message Queue in front of both Telnet
connections, this way producers can place their messages in the queue
asynchronously , and the backend (consumer) can pick them up in a FIFO.

Also, try using Net::SSH::Perl. The Net::Telnet does not give your things like
STDOUT, vs STDERR, vs Exit code. Net::Telnet puts everything in one channel.

The Security is yet another issue, specially when the session could be open
and idle for exessive amount of time. Your session can be hijacked easily.

"French, Shawn" wrote:

Vitals:
Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a on
Windows 2000 with PHP 4.21

I am working on a project that requires me to have two telnet objects per
user session opened, and accessible throughout the user's session. I have
looked at Apache::Session and many other solutions but my problem is that to
keep a Net::Telnet object, I need to keep open sockets and filehandles, so I
cannot serialize the object and store it in a database or file.

Currently I have similar code working flawlessly:
###
# "startup.pl" - called when apache starts (ie. PerlRequire
"d:/Apache/conf/startup.pl")
##
use MySite::Session;

###
# "Session.pm"
##
@EXPORT = qw( %sessionHash );
our %sessionHash;

###
# "init_session.pl" - called IN MOD_PERL when a new session is requested
##
use MySite::Session;
$sessionHash{$session_id . "_telnetObj"} = Net::Telnet->new();

###
# "dostuff.pl" - called IN MOD_PERL many time throughout the session
##
use MySite::Session;
my telnetObj = $sessionHash{$session_id . "_telnetObj"};
bless (\$telnetObj, "Net::Telnet");

Although this is working right now, I don't know enough [ anything? :) ]
about Apache or mod_perl to be sure that this will work in the future. What
I am really concerned about is that the telnetObj will only be accessible
from scripts run by the same child process as that which created and saved
it.

Is there a better way to do this?

Thanks,
Shawn French

-- 
-------------------------------------------------------------------------
Medi Montaseri                               [EMAIL PROTECTED]
Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
CyberShell Engineering
-------------------------------------------------------------------------
 


Reply via email to