Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl parent-child communication.

Reply
Thread Tools

Perl parent-child communication.

 
 
tower.grv@gmail.com
Guest
Posts: n/a
 
      04-24-2007
Hello.

I am developing application that has UDP server.
Application starts, create child thread (with fork), child thread call
function to create UDP server
#-------------------------------------------------------------------------
$sr = IO::Socket::INET->new(
Proto => "udp",
LocalPort => $MYPORT
);
while ($sr->recv($TD, 12) {
#here it need to send data to main (parent) thread.
}
#------------------------------------------------------------------------

I tried to use signals (%SIG and kill).
But width signals I can only call some function from parent process
and I can't send received data.
How can I do this?
What another ways methods be used to send data to parent process?

 
Reply With Quote
 
 
 
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      04-24-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hello.
>
> I am developing application that has UDP server.
> Application starts, create child thread (with fork), child thread call
> function to create UDP server
> #-------------------------------------------------------------------------
> $sr = IO::Socket::INET->new(
> Proto => "udp",
> LocalPort => $MYPORT
> );
> while ($sr->recv($TD, 12) {
> #here it need to send data to main (parent) thread.
> }
> #------------------------------------------------------------------------
>
> I tried to use signals (%SIG and kill).
> But width signals I can only call some function from parent process
> and I can't send received data.
> How can I do this?
> What another ways methods be used to send data to parent process?


See prldoc perlipc.

Anno
 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      04-24-2007
"(E-Mail Removed)" <(E-Mail Removed)> wrote:
> Hello.
>
> I am developing application that has UDP server.
> Application starts, create child thread (with fork), child thread call
> function to create UDP server
> #------------------------------------------------------------------------
> - $sr = IO::Socket::INET->new(
> Proto => "udp",
> LocalPort => $MYPORT
> );
> while ($sr->recv($TD, 12) {
> #here it need to send data to main (parent) thread.
> }
> #------------------------------------------------------------------------


Why does the child need to send data to the main thread? If the main
thread needs the data, why doesn't the main thread just dispense with the
child altogether and set up the UDP server itself and read the data itself?

>
> I tried to use signals (%SIG and kill).
> But width signals I can only call some function from parent process
> and I can't send received data.
> How can I do this?


With some kind of socket or pipe between the child and parent, if the child
is needed in the first place. What you have given us is a not a problem,
but rather a failed attempt at a solution. We can't tell you what the
successful solution will be unless you tell us what the actual problem you
are trying to solve is.

> What another ways methods be used to send data to parent process?


Other than pipes and sockets, there is shared memory. And I guess you
could use temp files.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 04-04-2011 10:00 PM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 02-27-2011 11:00 PM
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments