Re: Quick question

2011-10-07 Thread Ciprian Hacman
This should work:

use Socket 'unpack_sockaddr_in';
...
my $listener = $_[HEAP]{listener};
my ($port, $addr) = unpack_sockaddr_in($listener->getsockname);


Regards,
Ciprian

On Fri, Oct 7, 2011 at 11:24 PM, Cary Lewis  wrote:

> I want to create a TCP server that allocates a random TCP port - this is
> done by specifying port 0, but how do I determine which port has been
> allocated, prior to a client connecting to it?
>
> I need to set up some other configuration based on the port, so I need it
> right after the port is allocated.
>
> I am using POE::Component::Server::TCP
>
> Thanks.
>


Quick question

2011-10-07 Thread Cary Lewis
I want to create a TCP server that allocates a random TCP port - this is
done by specifying port 0, but how do I determine which port has been
allocated, prior to a client connecting to it?

I need to set up some other configuration based on the port, so I need it
right after the port is allocated.

I am using POE::Component::Server::TCP

Thanks.


Re: Quick question re. POE::Component::Client::HTTP

2004-02-11 Thread Rocco Caputo
On Wed, Feb 11, 2004 at 11:07:21AM +, James Brown wrote:
> Hi All,
> 
> I'm using POE::Component::Client::HTTP to 'stream-in' a web page in 
> chunks of size 4096. Could anyone tell me whether there is a 'shutdown' 
> event (or equivalent) for this component please?
> 
> If I send a '_stop' message to a session which created a component, 
> would this destroy the component as well?
> 
> Please excuse the 'newbieness' of my questions.

"Newbie" questions are welcome, at least until the list gets busy enough
to split into developer and user tracks.

There currently is no way to shut down a streaming request.  I could see
where it's needed for halting a streamed media download.

You can probably work around this by sending a signal to the HTTP
component, like:

  $_[KERNEL]->signal( ua => 'KILL' );

That should just kill off the component entirely, though.  Any parallel
requests would also be aborted, and you'd need to create a new
POE::Component::Client::HTTP if you wanted to run more requests.

This message has been Cc'd to [EMAIL PROTECTED]
so I'll remember that the feature's needed.

-- 
Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/


Quick question re. POE::Component::Client::HTTP

2004-02-11 Thread James Brown
Hi All,

I'm using POE::Component::Client::HTTP to 'stream-in' a web page in 
chunks of size 4096. Could anyone tell me whether there is a 'shutdown' 
event (or equivalent) for this component please?

If I send a '_stop' message to a session which created a component, 
would this destroy the component as well?

Please excuse the 'newbieness' of my questions.

Thanks,

James.