Re: Creating and shutting down POE::Sessions
Gabor Szabo <[email protected]> Thu, 19 May 2011 10:18:19 +0300
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
On Thu, May 19, 2011 at 5:28 AM, Rocco Caputo <[email protected]> wrote: > On May 18, 2011, at 09:30, Gabor Szabo wrote: > >> Hi, >> >> my baby steps in the land of POE: >> >> I have tried to setup a small application that would listen on a TCP >> port and get commands 'start' and 'stop', >> When receiving start it should create a new POE::Session to count. >> When receiving stop it should stop the counting and destroy that >> POE::Session. It seems I managed to do it but I'd be glad to receive >> comments about the code: > > > [code removed] > > Hi, Gabor. Please see the revised code below. The major change was to eliminate the counting session. They didn't seem necessary, and their presence just complicated things. > Hi Rocco, thanks for your reply. That looks indeed more simple. Reading again the documentation, do I understand correctly that already the ClientConnected and ClientInput are callbacks of the individual, connection related POE::Session? Further working on the application I am writing, I'll need to have several counters and keep the counters work even after the original requester disconnected. Trying with one, in my example it worked as the counter Session was not related to the connection. I wonder if in your solution, can I tell the session to remain active even after the user disconnected? Can I also remove it from the concurrency counter? Would in this case the separate POE::Session work better? regards Gabor