logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: First post, new POE apprentice some doubts to clarify: msg#00060

Subject: Re: First post, new POE apprentice some doubts to clarify
What happens if the IKC requests don't finish in less than five seconds, say
due to network delay?  Or if you want to run forever and then call a
shutdown routine when some predetermined event happens?

On 9/18/07, Matt Sickler <crazyfordynamite@xxxxxxxxx> wrote:
>
> Zack,
> The best way would be to clean up all of the things keeping the POE
> Kernel alive.
> In the client case, its the POE::Component::IKC::Client session.  Send
> it a shutdown event, and the program will clean itself up.
> See the updated example I put online (
> http://poe.perl.org/?POE_Cookbook/Inter_Kernel_Communique )
>
> On 9/18/07, Zack Payton <zpayton@xxxxxxxxx> wrote:
> > Marcel,
> >
> > Thanks for taking an interest in POE... please don't let my horrible
> example
> > deter you from reaping its' benefits.  I am the author of that example
> and
> > you are completely right, it's an error on my part.  The reason is that
> the
> > 1..10 post statements simply put the call statements in a queue which
> are to
> > be executed at the POE kernels convenience rather than right now (for
> > immediate execution use call rather than post).  I haven't looked
> closely
> > enough at the source however I'd bet a shiny plastic nickel that the
> _stop
> > event is prioritized and causes (as Matt indicates) the POE kernel to
> exit
> > before the "Inter Kernel Communique" occurs.  I'm not sure the best way
> to
> > handle an exit on the clients behalf and this is a very interesting
> > question.
> >
> > If we're not to call _stop directly, what is the best way to put an exit
> > event at the end of the queue to that all events are executed first and
> then
> > we gracefully terminate.
> >
> > Thanks,
> > Zack
> >
> > On 9/18/07, Marcel <webknowledge@xxxxxxxxx> wrote:
> > >
> > > Hello poe-masters!
> > >
> > > After reading the documentation, cases, samples, and understanding a
> > > little
> > > of the POE platform, I am dwelling with the examples at the cookbook
> > > section
> > > of the site, learning more, and trying to figure out some problems i'm
> > > having with the ikc_server and ikc_client example of Inter POE's
> Kernel
> > > Communique.
> > >
> > > As for now, i only get the response from ikc_server if i comment out
> the
> > > line below of the client, which supresses the yield(_stop) event to
> the
> > > server:
> > >
> > >     $kernel->yield('_stop');
> > >
> > > If this line remains uncommented, all i get from issuing the client is
> the
> > > line that is the output of the _stop event of the client:
> > >
> > > ~/learning_poe$ ./poe_ikc_client.pl
> > > Finished...
> > > ~/learning_poe$
> > >
> > > With that line commented out, issuing the execution of the client
> leads
> > > to:
> > >
> > > ~/learning_poe$ ./poe_ikc_client.pl
> > > Result!
> > > 1
> > > Result!
> > > 2
> > > Result!
> > > 3
> > > Result!
> > > 4
> > > Result!
> > > 5
> > > Result!
> > > 6
> > > Result!
> > > 7
> > > Result!
> > > 8
> > > Result!
> > > 9
> > > Result!
> > > 10
> > >
> > > But the client never finishes, but that behaviour was expected.
> > >
> > > At the server terminal:
> > >
> > > ~/learning_poe$ ./poe_ikc_server.pl
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > > Someone called!
> > >
> > > And the client communicates fine with the server.
> > >
> > > Can you point me what is the problem with that example given?
> > >
> > > Thank you in advance,
> > >
> > > Marcel Mitsuto.
> > >
> >
>
<Prev in Thread] Current Thread [Next in Thread>