Hi! If I understood correctly we should always use DemuxingProtocolCodecFactory since most of the socket connections are TCP/IP, this include HTTP server, Chat server and etc. May I know in what scenario that we will choose other codec over the DemuxingProtocolCodecFactory? I think it would be very helpful if we can add some guidelines into the API description.
On 9/8/06, Trustin Lee <[EMAIL PROTECTED]> wrote:
Hi Lee, On 9/8/06, Lee Kemp <[EMAIL PROTECTED]> wrote: > > Thanks Trustin, > > Just to answer Nilas I am using Mina 0.9.5 on Fedora Core 4. > > I have changed my codec to use DemuxingProtocolCodecFactory and it > has made a big difference. I am not longer receiving messages > missing there headers but I am still getting some (not as many) with > the header of the next message on the end of it. > > if the length of the message is to long I am returning > MessageDecoder.NOT_OK in my decodable method. If I do this a then a > "ProtocolDecoderException: No appropriate message decoder" gets > thrown by the DemuxingProtocolCodecFactory and the user gets > disconnected from the server. > > Is there a better way for me to check if my message is to long or to > make sure it stops at the next messages header? You shouldn't return NOT_OK but return OK after reading until just before the beginning of the next message. Then DemuxingProtocolCodecFilter will take care of splitting the next message for you. And there can be a case when the received buffer doesn't contain a whole message, then you have to return NOT_YET, then DemuxingProtocolCodecFilter will call the decoder again when more data is received. BTW I think you really need to understand how TCP/IP works because it's not a problem of MINA, but it's an expected behavior of TCP/IP. Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP key fingerprints: * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
