For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > June 2007 > Access to socket from PoCo::Server::TCP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Access to socket from PoCo::Server::TCP
Rohan Almeida

2007-05-22, 10:17 pm


Hi,

Is there any way I can get access to the underlying socket while
using PoCo::Server::TCP without using the Client* callbacks?

The docs say that the socket is only passed if I use the Acceptor
callback, which then means I have to create my own Wheel for
read/write and so on.

Again, $heap->{listener} is only available if I use the Acceptor
callback. $heap->{client} seems to be a ReadWrite wheel. I tried
accessing the Handle for this wheel (which should be the socket),
but I'm not getting anywhere.

Thanks,
Rohan

Matt Sickler

2007-05-22, 10:17 pm

There arent any documented ways to get at a ReadWrite wheel's handle.
The non-POE way you could do it (and breaking encapsulation) would be to use
$heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_INPUT ] and
$heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_OUTPUT ]
( those would be the same in many situations ).
This breaks encapsulation and could change at no notice and its all your fault.

A better question you need to ask is why do you need to get at the socket?

On 5/22/07, Rohan Almeida <rohan@almeida.in> wrote:
>
> Hi,
>
> Is there any way I can get access to the underlying socket while
> using PoCo::Server::TCP without using the Client* callbacks?
>
> The docs say that the socket is only passed if I use the Acceptor
> callback, which then means I have to create my own Wheel for
> read/write and so on.
>
> Again, $heap->{listener} is only available if I use the Acceptor
> callback. $heap->{client} seems to be a ReadWrite wheel. I tried
> accessing the Handle for this wheel (which should be the socket),
> but I'm not getting anywhere.
>
> Thanks,
> Rohan
>
>

Rohan Almeida

2007-05-23, 4:38 am


I need access to the socket, as I have to use the getsockopt
call. I don't have any problems with using SocketFactory and
Wheels for my server. Just though it would be nice if
PoCo::Server::TCP does provide access to the socket.

Thanks,
Rohan

Matt Sickler wrote:
> There arent any documented ways to get at a ReadWrite wheel's handle.
> The non-POE way you could do it (and breaking encapsulation) would be to
> use
> $heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_INPUT ] and
> $heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_OUTPUT ]
> ( those would be the same in many situations ).
> This breaks encapsulation and could change at no notice and its all your
> fault.
>
> A better question you need to ask is why do you need to get at the socket?
>
> On 5/22/07, Rohan Almeida <rohan@almeida.in> wrote:
>


Curtis J. Coleman

2007-05-23, 4:38 am

I had a need to retrieve TCP_MAXSEG from getsockopt once.

On Tue, May 22, 2007 at 09:51:04PM -0500, Matt Sickler wrote:[color=darkred]
> There arent any documented ways to get at a ReadWrite wheel's handle.
> The non-POE way you could do it (and breaking encapsulation) would be to use
> $heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_INPUT ] and
> $heap->{client}->[ POE::Wheel::ReadWrite::HANDLE_OUTPUT ]
> ( those would be the same in many situations ).
> This breaks encapsulation and could change at no notice and its all your
> fault.
>
> A better question you need to ask is why do you need to get at the socket?
>
> On 5/22/07, Rohan Almeida <rohan@almeida.in> wrote:
Matt Sickler

2007-05-23, 7:22 pm

The component wouldnt be the one to provide access to it.
You would need to patch POE::Wheel::ReadWrite to provide an accessor
method to the input and output handles.

On 5/22/07, Rohan Almeida <rohan@almeida.in> wrote:
>
> I need access to the socket, as I have to use the getsockopt
> call. I don't have any problems with using SocketFactory and
> Wheels for my server. Just though it would be nice if
> PoCo::Server::TCP does provide access to the socket.
>
> Thanks,
> Rohan
>
> Matt Sickler wrote:
>
>

Nicholas Perez

2007-05-23, 7:22 pm

I seem to remember wanting similar functionality in the past and it
was countered for some reason. A wheel would be useless without the
handles (ie, yanked out via accessor), but it keeps the end developer
from holding onto a reference to the handles when building the wheel
in the first place.

On 5/23/07, Matt Sickler <crazyfordynamite@gmail.com> wrote:
> The component wouldnt be the one to provide access to it.
> You would need to patch POE::Wheel::ReadWrite to provide an accessor
> method to the input and output handles.
>
> On 5/22/07, Rohan Almeida <rohan@almeida.in> wrote:
>

Matt Sickler

2007-05-23, 7:22 pm

Perhaps a better way would be to have methods that do the getsockopt
calls themselves?

On 5/23/07, Nicholas Perez <nicholasrperez@gmail.com> wrote:
> I seem to remember wanting similar functionality in the past and it
> was countered for some reason. A wheel would be useless without the
> handles (ie, yanked out via accessor), but it keeps the end developer
> from holding onto a reference to the handles when building the wheel
> in the first place.
>
> On 5/23/07, Matt Sickler <crazyfordynamite@gmail.com> wrote:
>

Rohan Almeida

2007-05-23, 7:22 pm


Matt Sickler wrote:
> Perhaps a better way would be to have methods that do the getsockopt
> calls themselves?


There would be no end to this. Why use layered methods when a
simple getsockopt (and others) on the socket would suffice?

--
Rohan


> On 5/23/07, Nicholas Perez <nicholasrperez@gmail.com> wrote:
>


Rohan Almeida

2007-05-23, 7:23 pm


Matt Sickler wrote:
> Perhaps a better way would be to have methods that do the getsockopt
> calls themselves?


There would be no end to this. Why use layered methods when a
simple getsockopt (and others) on the socket would suffice?

--
Rohan


> On 5/23/07, Nicholas Perez <nicholasrperez@gmail.com> wrote:
>


Matt Sickler

2007-05-24, 4:35 am

I just committed a change that adds get_input_handle and
get_output_handle methods to Wheel::ReadWrite. :)

On 5/23/07, Rohan Almeida <rohan@almeida.in> wrote:
>
> Matt Sickler wrote:
>
> There would be no end to this. Why use layered methods when a
> simple getsockopt (and others) on the socket would suffice?
>
> --
> Rohan
>
>
>
>

Rohan Almeida

2007-05-24, 4:35 am


Matt Sickler wrote:
> I just committed a change that adds get_input_handle and
> get_output_handle methods to Wheel::ReadWrite. :)


Thats great! I can see the changes in Sourceforge. Will download
the tarball from there.

Thanks,
Rohan



> On 5/23/07, Rohan Almeida <rohan@almeida.in> wrote:
>


Posterjo73

2007-05-30, 10:24 am

http://Angelina-Jolie-doing-it.info...p?movie=1673286
Doae

2007-06-04, 9:51 am

They are hot and wet!
http://nice-females-dicked.org/video?id=218571
Adpoencejoted66

2007-06-06, 9:01 am

Paula Abdul and Alyson Hannigan , Lesbian Girl Sex!
http://www.theillegalsite.com/Media...p?movie=1673286

Jessica Simpson and Catherine Z. Jones Vibrating In Slits!
http://www.theillegalsite.com/MediaPlayer?q=1673286

Helen Hunt and Christina Applegate At Pillow War Game!
http://www.theillegalsite.com/watch?vid=1673286

Tara Reid and Catherine Z. Jones In Pussy Cucumber!
http://www.theillegalsite.com/Watch?clip=1673286

Hilary Duff and Hilary Swank licking each other all over by the truck!
http://www.theillegalsite.com/Media....cgi?id=1673286
Jenster

2007-06-15, 2:05 am

Tara Reid and Tara Reid Become Lesbians!
http://www.videomoviesonline.com/pl...p?watch=1673286
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com