You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by aquafina <pl...@mailinator.com> on 2007/12/06 20:16:11 UTC

sending/receiving a byte[]

Hello,

I am new with MINA. Would anyone please show me how to configure
SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
Serializable object and used 

cfg.getFilterChain().addLast(
                "codec",
                new ProtocolCodecFilter(
                        new ObjectSerializationCodecFactory())); 

but it doesn't seem to work.

Thanks,


-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14199165
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by Maarten Bosteels <mb...@gmail.com>.
oops, sorry for that :-)

On Dec 7, 2007 9:48 PM, Khanh Nguyen <kn...@cs.umb.edu> wrote:
>
> Never mind, I found the bug, the buffer in encode() must be allocate as
>
> ByteBuffer buffer = ByteBuffer.allocate( bytes.length + 4, false );
>
> instead of
>
> ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );
>
>
>
>
>
>
> Khanh Nguyen wrote:
> >
> > Hi Maarten,
> >
> > This is very helpful. I tried, but still haven't quite figured it out
> >
> > I used your code to create ByteArrayEncoder and ByteArrayDecoder verbatim.
> > Then write a simple ByteArrayCodecFactory
> >
> > public class ByteArrayCodecFactory implements ProtocolCodecFactory {
> >     private ProtocolEncoder encoder;
> >     private ProtocolDecoder decoder;
> >       public ByteArrayCodecFactory(){
> >               encoder = new ByteArrayEncoder();
> >               decoder = new ByteArrayDecoder();
> >       }
> >       public ProtocolEncoder getEncoder() throws Exception{
> >               return encoder;
> >       }
> >       public ProtocolDecoder getDecoder() throws Exception{
> >               return decoder;
> >       }
> > }
> >
> >
> > when a session created, I send a byte[] from the server to the client
> >
> > public void sessionCreated(IoSession session) throws Exception {
> >       if( session.getTransportType() == TransportType.SOCKET ){
> >               ((SocketSessionConfig) session.getConfig() ).setReceiveBufferSize( 2048
> > );
> >               ((SocketSessionConfig) session.getConfig() ).setSendBufferSize(2048);
> >       }
> >       byte[] arr = new byte[300000];
> >       for (int i = 0;i<arr.length;i++) arr[i] = 1;
> >       session.write(arr);
> > }
> >
> > , nothing happens on the client side. Also, when I look more closely, the
> > encoder seems to stop at "buffer.put(bytes);" (I put a
> > System.out.println() after and nothing was printed).
> >
> > If I want my byte[] to have a length of 300.000, should I set
> > in.prefixedDataAvailable(4,300000)?
> >
> > Thank you very much,
> >
> > Sincerely,
> >
> > Khanh Nguyen
> >
> >
> > Maarten Bosteels wrote:
> >>
> >> Hi Aquafina,
> >>
> >> You want to send and receive byte arrays, right ?
> >> If the byte array can contain any byte value, you can't use a
> >> delimiter, so the only option I see is to use a length prefix.
> >>
> >> Have a look at the codec tutorial
> >> http://mina.apache.org/tutorial-on-protocolcodecfilter.html
> >>
> >> A Codec for encoding/decoding byte[] objects is really easy.
> >> The decoder would look like this:
> >>
> >> protected boolean doDecode(IoSession session, ByteBuffer in,
> >> ProtocolDecoderOutput out) throws Exception {
> >>         if (in.prefixedDataAvailable(4)) {
> >>             int length = in.getInt();
> >>             byte[] bytes = new byte[length];
> >>             in.get(bytes);
> >>             out.write(bytes);
> >>             return true;
> >>         } else {
> >>           return false;
> >>         }
> >>     }
> >>
> >> The encoder looks like this:
> >>
> >>   public void encode(IoSession session, Object message,
> >> ProtocolEncoderOutput out) throws Exception {
> >>      byte[] bytes = (byte[]) message;
> >>     ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );
> >>     buffer.putInt(bytes.length);
> >>     buffer.put(bytes);
> >>     buffer.flip();
> >>     out.write(buffer);
> >>   }
> >>
> >> We are using this approach to send/receive xml documents. We can't use
> >> strings because we don't know which encoding
> >> (UTF-8, UTF-16, ...) the client is going to use. We pass the byte[] to
> >> the xml parser, which will correctly detect the encoding specified in
> >> the xml itself.
> >>
> >> HTH
> >> Maarten
> >>
> >>
> >> On Dec 7, 2007 5:23 AM, aquafina <pl...@mailinator.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte
> >>> array
> >>> of 300.000 elements?
> >>>
> >>>
> >>>
> >>> Qi wrote:
> >>> >
> >>> > Hi Aquafina,
> >>> >
> >>> > I'm not a MINA expert, but as far as I know, you can wrap a byte array
> >>> > into ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset,
> >>> int
> >>> > length), and send it through IoSession.write(the ByteBuffer instance);
> >>> > Please be aware that by doing this, you bypass your costumized
> >>> > ProtocalEncoder/Decoder.
> >>> >
> >>> > Wrap a byte array into a serilizable object, just in sake of sending
> >>> it
> >>> > alone, is a bit redundant IMHO. The wrap object will need to go
> >>> through
> >>> > ObjectSerializationDecoder and ObjectSerializationEncoder, which add
> >>> some
> >>> > extra cost.
> >>> >
> >>> > Cheers,
> >>> > Qi
> >>> >
> >>> >
> >>> > aquafina wrote:
> >>> >>
> >>> >> Hello,
> >>> >>
> >>> >> I am new with MINA. Would anyone please show me how to configure
> >>> >> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it
> >>> with a
> >>> >> Serializable object and used
> >>> >>
> >>> >> cfg.getFilterChain().addLast(
> >>> >>                 "codec",
> >>> >>                 new ProtocolCodecFilter(
> >>> >>                         new ObjectSerializationCodecFactory()));
> >>> >>
> >>> >> but it doesn't seem to work.
> >>> >>
> >>> >> Thanks,
> >>> >>
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206617
> >>>
> >>> Sent from the Apache MINA Support Forum mailing list archive at
> >>> Nabble.com.
> >>>
> >>>
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14220485
>
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>

Re: sending/receiving a byte[]

Posted by Khanh Nguyen <kn...@cs.umb.edu>.
Never mind, I found the bug, the buffer in encode() must be allocate as 

ByteBuffer buffer = ByteBuffer.allocate( bytes.length + 4, false );

instead of 

ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );





Khanh Nguyen wrote:
> 
> Hi Maarten,
> 
> This is very helpful. I tried, but still haven't quite figured it out
> 
> I used your code to create ByteArrayEncoder and ByteArrayDecoder verbatim.
> Then write a simple ByteArrayCodecFactory
> 
> public class ByteArrayCodecFactory implements ProtocolCodecFactory {
>     private ProtocolEncoder encoder;
>     private ProtocolDecoder decoder;
> 	public ByteArrayCodecFactory(){
> 		encoder = new ByteArrayEncoder();
> 		decoder = new ByteArrayDecoder();
> 	}
> 	public ProtocolEncoder getEncoder() throws Exception{
> 		return encoder;
> 	}
> 	public ProtocolDecoder getDecoder() throws Exception{
> 		return decoder;
> 	}
> }
> 
> 
> when a session created, I send a byte[] from the server to the client 
> 
> public void sessionCreated(IoSession session) throws Exception {
> 	if( session.getTransportType() == TransportType.SOCKET ){
> 		((SocketSessionConfig) session.getConfig() ).setReceiveBufferSize( 2048
> );
> 		((SocketSessionConfig) session.getConfig() ).setSendBufferSize(2048);
> 	}
> 	byte[] arr = new byte[300000];
> 	for (int i = 0;i<arr.length;i++) arr[i] = 1;
> 	session.write(arr);
> }
> 
> , nothing happens on the client side. Also, when I look more closely, the
> encoder seems to stop at "buffer.put(bytes);" (I put a
> System.out.println() after and nothing was printed).
> 
> If I want my byte[] to have a length of 300.000, should I set
> in.prefixedDataAvailable(4,300000)?
> 
> Thank you very much,
> 
> Sincerely,
> 
> Khanh Nguyen
> 
> 
> Maarten Bosteels wrote:
>> 
>> Hi Aquafina,
>> 
>> You want to send and receive byte arrays, right ?
>> If the byte array can contain any byte value, you can't use a
>> delimiter, so the only option I see is to use a length prefix.
>> 
>> Have a look at the codec tutorial
>> http://mina.apache.org/tutorial-on-protocolcodecfilter.html
>> 
>> A Codec for encoding/decoding byte[] objects is really easy.
>> The decoder would look like this:
>> 
>> protected boolean doDecode(IoSession session, ByteBuffer in,
>> ProtocolDecoderOutput out) throws Exception {
>>         if (in.prefixedDataAvailable(4)) {
>>             int length = in.getInt();
>>             byte[] bytes = new byte[length];
>>             in.get(bytes);
>>             out.write(bytes);
>>             return true;
>>         } else {
>>           return false;
>>         }
>>     }
>> 
>> The encoder looks like this:
>> 
>>   public void encode(IoSession session, Object message,
>> ProtocolEncoderOutput out) throws Exception {
>>      byte[] bytes = (byte[]) message;
>>     ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );
>>     buffer.putInt(bytes.length);
>>     buffer.put(bytes);
>>     buffer.flip();
>>     out.write(buffer);
>>   }
>> 
>> We are using this approach to send/receive xml documents. We can't use
>> strings because we don't know which encoding
>> (UTF-8, UTF-16, ...) the client is going to use. We pass the byte[] to
>> the xml parser, which will correctly detect the encoding specified in
>> the xml itself.
>> 
>> HTH
>> Maarten
>> 
>> 
>> On Dec 7, 2007 5:23 AM, aquafina <pl...@mailinator.com> wrote:
>>>
>>> Hello,
>>>
>>> Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte
>>> array
>>> of 300.000 elements?
>>>
>>>
>>>
>>> Qi wrote:
>>> >
>>> > Hi Aquafina,
>>> >
>>> > I'm not a MINA expert, but as far as I know, you can wrap a byte array
>>> > into ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset,
>>> int
>>> > length), and send it through IoSession.write(the ByteBuffer instance);
>>> > Please be aware that by doing this, you bypass your costumized
>>> > ProtocalEncoder/Decoder.
>>> >
>>> > Wrap a byte array into a serilizable object, just in sake of sending
>>> it
>>> > alone, is a bit redundant IMHO. The wrap object will need to go
>>> through
>>> > ObjectSerializationDecoder and ObjectSerializationEncoder, which add
>>> some
>>> > extra cost.
>>> >
>>> > Cheers,
>>> > Qi
>>> >
>>> >
>>> > aquafina wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I am new with MINA. Would anyone please show me how to configure
>>> >> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it
>>> with a
>>> >> Serializable object and used
>>> >>
>>> >> cfg.getFilterChain().addLast(
>>> >>                 "codec",
>>> >>                 new ProtocolCodecFilter(
>>> >>                         new ObjectSerializationCodecFactory()));
>>> >>
>>> >> but it doesn't seem to work.
>>> >>
>>> >> Thanks,
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206617
>>>
>>> Sent from the Apache MINA Support Forum mailing list archive at
>>> Nabble.com.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14220485
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by aquafina <pl...@mailinator.com>.
Hi Maarten,

This is very helpful. I tried, but still haven't quite figured it out

I used your code to create ByteArrayEncoder and ByteArrayDecoder verbatim.
Then write a simple ByteArrayCodecFactory

public class ByteArrayCodecFactory implements ProtocolCodecFactory {
    private ProtocolEncoder encoder;
    private ProtocolDecoder decoder;
	public ByteArrayCodecFactory(){
		encoder = new ByteArrayEncoder();
		decoder = new ByteArrayDecoder();
	}
	public ProtocolEncoder getEncoder() throws Exception{
		return encoder;
	}
	public ProtocolDecoder getDecoder() throws Exception{
		return decoder;
	}
}


when a session created, I send a byte[] from the server to the client 

public void sessionCreated(IoSession session) throws Exception {
	if( session.getTransportType() == TransportType.SOCKET ){
		((SocketSessionConfig) session.getConfig() ).setReceiveBufferSize( 2048 );
		((SocketSessionConfig) session.getConfig() ).setSendBufferSize(2048);
	}
	byte[] arr = new byte[300000];
	for (int i = 0;i<arr.length;i++) arr[i] = 1;
	session.write(arr);
}

, nothing happens on the client side. Also, when I look more closely, the
encoder seems to stop at "buffer.put(bytes);" (I put a System.out.println()
after and nothing was printed).

If I want my byte[] to have a length of 300.000, should I set
in.prefixedDataAvailable(4,300000)?

Thank you very much,

Sincerely,

Khanh Nguyen


Maarten Bosteels wrote:
> 
> Hi Aquafina,
> 
> You want to send and receive byte arrays, right ?
> If the byte array can contain any byte value, you can't use a
> delimiter, so the only option I see is to use a length prefix.
> 
> Have a look at the codec tutorial
> http://mina.apache.org/tutorial-on-protocolcodecfilter.html
> 
> A Codec for encoding/decoding byte[] objects is really easy.
> The decoder would look like this:
> 
> protected boolean doDecode(IoSession session, ByteBuffer in,
> ProtocolDecoderOutput out) throws Exception {
>         if (in.prefixedDataAvailable(4)) {
>             int length = in.getInt();
>             byte[] bytes = new byte[length];
>             in.get(bytes);
>             out.write(bytes);
>             return true;
>         } else {
>           return false;
>         }
>     }
> 
> The encoder looks like this:
> 
>   public void encode(IoSession session, Object message,
> ProtocolEncoderOutput out) throws Exception {
>      byte[] bytes = (byte[]) message;
>     ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );
>     buffer.putInt(bytes.length);
>     buffer.put(bytes);
>     buffer.flip();
>     out.write(buffer);
>   }
> 
> We are using this approach to send/receive xml documents. We can't use
> strings because we don't know which encoding
> (UTF-8, UTF-16, ...) the client is going to use. We pass the byte[] to
> the xml parser, which will correctly detect the encoding specified in
> the xml itself.
> 
> HTH
> Maarten
> 
> 
> On Dec 7, 2007 5:23 AM, aquafina <pl...@mailinator.com> wrote:
>>
>> Hello,
>>
>> Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte
>> array
>> of 300.000 elements?
>>
>>
>>
>> Qi wrote:
>> >
>> > Hi Aquafina,
>> >
>> > I'm not a MINA expert, but as far as I know, you can wrap a byte array
>> > into ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset,
>> int
>> > length), and send it through IoSession.write(the ByteBuffer instance);
>> > Please be aware that by doing this, you bypass your costumized
>> > ProtocalEncoder/Decoder.
>> >
>> > Wrap a byte array into a serilizable object, just in sake of sending it
>> > alone, is a bit redundant IMHO. The wrap object will need to go through
>> > ObjectSerializationDecoder and ObjectSerializationEncoder, which add
>> some
>> > extra cost.
>> >
>> > Cheers,
>> > Qi
>> >
>> >
>> > aquafina wrote:
>> >>
>> >> Hello,
>> >>
>> >> I am new with MINA. Would anyone please show me how to configure
>> >> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with
>> a
>> >> Serializable object and used
>> >>
>> >> cfg.getFilterChain().addLast(
>> >>                 "codec",
>> >>                 new ProtocolCodecFilter(
>> >>                         new ObjectSerializationCodecFactory()));
>> >>
>> >> but it doesn't seem to work.
>> >>
>> >> Thanks,
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206617
>>
>> Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14219225
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by Maarten Bosteels <mb...@gmail.com>.
Hi Aquafina,

You want to send and receive byte arrays, right ?
If the byte array can contain any byte value, you can't use a
delimiter, so the only option I see is to use a length prefix.

Have a look at the codec tutorial
http://mina.apache.org/tutorial-on-protocolcodecfilter.html

A Codec for encoding/decoding byte[] objects is really easy.
The decoder would look like this:

protected boolean doDecode(IoSession session, ByteBuffer in,
ProtocolDecoderOutput out) throws Exception {
        if (in.prefixedDataAvailable(4)) {
            int length = in.getInt();
            byte[] bytes = new byte[length];
            in.get(bytes);
            out.write(bytes);
            return true;
        } else {
          return false;
        }
    }

The encoder looks like this:

  public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
     byte[] bytes = (byte[]) message;
    ByteBuffer buffer = ByteBuffer.allocate( bytes.length, false );
    buffer.putInt(bytes.length);
    buffer.put(bytes);
    buffer.flip();
    out.write(buffer);
  }

We are using this approach to send/receive xml documents. We can't use
strings because we don't know which encoding
(UTF-8, UTF-16, ...) the client is going to use. We pass the byte[] to
the xml parser, which will correctly detect the encoding specified in
the xml itself.

HTH
Maarten


On Dec 7, 2007 5:23 AM, aquafina <pl...@mailinator.com> wrote:
>
> Hello,
>
> Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte array
> of 300.000 elements?
>
>
>
> Qi wrote:
> >
> > Hi Aquafina,
> >
> > I'm not a MINA expert, but as far as I know, you can wrap a byte array
> > into ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset, int
> > length), and send it through IoSession.write(the ByteBuffer instance);
> > Please be aware that by doing this, you bypass your costumized
> > ProtocalEncoder/Decoder.
> >
> > Wrap a byte array into a serilizable object, just in sake of sending it
> > alone, is a bit redundant IMHO. The wrap object will need to go through
> > ObjectSerializationDecoder and ObjectSerializationEncoder, which add some
> > extra cost.
> >
> > Cheers,
> > Qi
> >
> >
> > aquafina wrote:
> >>
> >> Hello,
> >>
> >> I am new with MINA. Would anyone please show me how to configure
> >> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
> >> Serializable object and used
> >>
> >> cfg.getFilterChain().addLast(
> >>                 "codec",
> >>                 new ProtocolCodecFilter(
> >>                         new ObjectSerializationCodecFactory()));
> >>
> >> but it doesn't seem to work.
> >>
> >> Thanks,
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206617
>
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>

Re: sending/receiving a byte[]

Posted by Trustin Lee <tr...@gmail.com>.
On Dec 7, 2007 1:23 PM, aquafina <pl...@mailinator.com> wrote:
>
> Hello,
>
> Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte array
> of 300.000 elements?

Not at all.  However, your message will be split into many pieces
although it will always happen even if you have huge receive buffer
size.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: sending/receiving a byte[]

Posted by aquafina <pl...@mailinator.com>.
Hello, 

Do I need to set ReceiveBufferSize = 300.000 if I want to send a byte array
of 300.000 elements?


Qi wrote:
> 
> Hi Aquafina,
> 
> I'm not a MINA expert, but as far as I know, you can wrap a byte array
> into ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset, int
> length), and send it through IoSession.write(the ByteBuffer instance);
> Please be aware that by doing this, you bypass your costumized
> ProtocalEncoder/Decoder.
> 
> Wrap a byte array into a serilizable object, just in sake of sending it
> alone, is a bit redundant IMHO. The wrap object will need to go through
> ObjectSerializationDecoder and ObjectSerializationEncoder, which add some
> extra cost.
> 
> Cheers,
> Qi
> 
> 
> aquafina wrote:
>> 
>> Hello,
>> 
>> I am new with MINA. Would anyone please show me how to configure
>> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
>> Serializable object and used 
>> 
>> cfg.getFilterChain().addLast(
>>                 "codec",
>>                 new ProtocolCodecFilter(
>>                         new ObjectSerializationCodecFactory())); 
>> 
>> but it doesn't seem to work.
>> 
>> Thanks,
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206617
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by Qi <sa...@gmail.com>.
Hi Aquafina,

I'm not a MINA expert, but as far as I know, you can wrap a byte array into
ByteBuffer by using ByteBuffer.wrap(byte[] byteArray, int offset, int
length), and send it through IoSession.write(the ByteBuffer instance);
Please be aware that by doing this, you bypass your costumized
ProtocalEncoder/Decoder.

Wrap a byte array into a serilizable object, just in sake of sending it
alone, is a bit redundant IMHO. The wrap object will need to go through
ObjectSerializationDecoder and ObjectSerializationEncoder, which add some
extra cost.

Cheers,
Qi


aquafina wrote:
> 
> Hello,
> 
> I am new with MINA. Would anyone please show me how to configure
> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
> Serializable object and used 
> 
> cfg.getFilterChain().addLast(
>                 "codec",
>                 new ProtocolCodecFilter(
>                         new ObjectSerializationCodecFactory())); 
> 
> but it doesn't seem to work.
> 
> Thanks,
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14203971
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by aquafina <pl...@mailinator.com>.
There were no exception. Only that it seems client never received anything

When I changed ProtocolCodecFilter to TextLineFactory and sent a string, it
works. 



Trustin Lee wrote:
> 
> What exception do you get?
> 
> On Dec 7, 2007 4:16 AM, aquafina <pl...@mailinator.com> wrote:
>>
>> Hello,
>>
>> I am new with MINA. Would anyone please show me how to configure
>> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
>> Serializable object and used
>>
>> cfg.getFilterChain().addLast(
>>                 "codec",
>>                 new ProtocolCodecFilter(
>>                         new ObjectSerializationCodecFactory()));
>>
>> but it doesn't seem to work.
>>
>> Thanks,
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14199165
>> Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14206605
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: sending/receiving a byte[]

Posted by Trustin Lee <tr...@gmail.com>.
What exception do you get?

On Dec 7, 2007 4:16 AM, aquafina <pl...@mailinator.com> wrote:
>
> Hello,
>
> I am new with MINA. Would anyone please show me how to configure
> SocketAcceptorConfig to receive/send a byte[]. I tried to wrap it with a
> Serializable object and used
>
> cfg.getFilterChain().addLast(
>                 "codec",
>                 new ProtocolCodecFilter(
>                         new ObjectSerializationCodecFactory()));
>
> but it doesn't seem to work.
>
> Thanks,
>
>
> --
> View this message in context: http://www.nabble.com/sending-receiving-a-byte---tf4958040s16868.html#a14199165
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6