One caveat to my approach.

I realized that I would have to move the SessionLog.info() call ahead
of the write() call if my approach needs to work.

thanks,
Srikanth

On 4/11/06, Srikanth Veeramachaneni <[EMAIL PROTECTED]> wrote:
> Hi Niklas,
>
> I was looking at your tunneling proxy example.
>
> In AbstractProxyIoHandler.messageReceived() method, is there any
> problem if we do this
> --------------------------------------
>         ByteBuffer rb = ( ByteBuffer ) message;
>         rb.acquire();
>         ( ( IoSession ) session.getAttachment() ).write( rb );
>         SessionLog.info( session, rb.getString( CHARSET.newDecoder() ) );
> --------------------------------------
> instead of
> --------------------------------------
>         ByteBuffer rb = ( ByteBuffer ) message;
>         ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
>         rb.mark();
>         wb.put( rb );
>         wb.flip();
>         ( ( IoSession ) session.getAttachment() ).write( wb );
>         rb.reset();
>         SessionLog.info( session, rb.getString( CHARSET.newDecoder() ) );
> --------------------------------------
>
> Basically, is there a problem doing an acquire() instead of making a
> copy of the byte buffer when I want to use the byte buffer for writes.
>
> thanks,
> Srikanth
>
> On 4/11/06, Niklas Therning <[EMAIL PROTECTED]> wrote:
> > Vinod Panicker wrote:
> > > On 4/11/06, Cameron Taggart <[EMAIL PROTECTED]> wrote:
> > > ...
> > >
> > >>I am just trying to create a proxy to act as a middleman between the
> > >>SlimServer 6.2.1 (http://www.slimdevices.com/su_downloads.html)
> > >>software written primarily in Perl, and my Squeezebox.  It is one step
> > >>closer than viewing all the communication with Ethereal.
> > >
> > >
> > > So basically what you want to do is tunnel everything?
> >
> > I just checked in an example of a tunneling proxy. Have a look at it if
> > you want to. There are some tricks in there to make things work (I'm
> > thinking about the setTrafficMask() stuff). I'll be happy to explain why
> > those things are necessary. Just let me know.
> >
> > /Niklas
> >
>

Reply via email to