|Don't ask to ask, just ask|
How to share Class object of one process to other external process?by srlbharu (Acolyte)
|on Mar 05, 2013 at 06:10 UTC||Need Help??|
srlbharu has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, I have created Telnet object in one class's new function. Using this telnet object I am sending and receiving commands and respective responses.
But the design should be like this: I need to send the command in the current process using the telnet object but, receiving the response should be in the other process with the same telnet object.
+----------+ +----------+ | Client | Telnet | Server | | | | | | +----+ | Send cmds | | | |Proc|--|------------->| | | |ess1|<-|--------------| | | +----+ | Rx Res | | | | | | | | +----| | | +----+ | | +----------+ | |Proc| | | | |ess2|<-|---------+ | +----+ | Rx Res | | +----------+
To achieve this, I tried to use below methods to spawn a process.
I created the external process using Win32::Process but from the main process, how can I get the telnet object to receive the responses.
From the diagram, I am sending commands and waiting for the response. Once the response comes then I move to the next command to send.
For some commands, response will be coming only after the next command is passed.
To pass the next command, I should come out from the wait loop.
Hence I am trying to create a child process for the wait loop.
Perl version: 5.6 OS: Windows