> > Hi,
> >
> > If I'm using POE::Component::Client::TCP is there a way I can manually
read
> > the socket, as opposed to having each message fire the ServerInput
method?
> > It might seem counter POE, but I'd like to get the ConnectError,
> > Disconnected, and Filter from Client::TCP, but I want to read the
message in
> > at my own pace.
>
> No.  Disconnect happens as a result of sysread() returning error zero.
> Client::TCP can't announce a disconnection unless it's also reading the
> socket.
>
> Have you seen http://poe.perl.org/?Evolution_of_a_poe_server ?  It's
> server side, but it shows a few different ways to build and work with
> sockets.  Maybe Wheel::SocketFactory and Wheel::ReadWrite (or perhaps
> just select_read) will suit your problem better.
>
> --
> Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

If I want to read the socket manually, Wheel::ReadWrite (I think) is going
to present the same problem as Component::TCP::Client, that is, every time
some data comes down the pipe it's going to invoke an event.

My situation is the server sends variable length records down the pipe, I
have to pick up the record type (first) to figure out how many more fields
to read.  Furthermore within the records are embedded records (with a field
telling me how many records are within).  And lastly, there is a record
version #, which tells me the format (old, new) of the record (i.e. as more
functionality is added to the server, more fields are added to the record
sent down the pipe), I need to talk to various versions of the server.

If I get an event for each field, buffer it, then have this hairy logic to
figure out if I've got enough data.  I'll have to do this over and over for
each field.

I think I'm going to have to roll my own.

Thanks
Jay


Reply via email to