On Sat, Nov 14, 2009 at 1:33 PM, Mark Wallsgrove < [email protected]> wrote:
> Hey all, > > Thanks for the replies. > > #Emmanuel > The reason why I asked was due to a lack of understanding of Mina. The > documentation never stated such a fact, so regarded it as being > something odd. It *is* in the documentation: http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html " without a ProtocolCodecFilter [...] multiple calls of IoSession.write(Object message) can lead to a single messageReceived event" Maarten > But none the less there is no need to be aggressive > about someone being inquisitive. > > #Will > Thanks for your explanation. Something like that should be noted in > the documentation. It gives the impression that you only need to deal > with packets being fragmented. > > Best Regards, > Mark Wallsgrove > > > 2009/11/13 <[email protected]>: > > Hello Mark > > > > I think it is a bad idea to every trust a "packet" unit in tcp (what > you receive in one receive call, or send in one send call) as a unit which > you can depend on. TCP works with streams rather than packets, so anything > you view as a unit on the sending side is not guaranteed to be a unit on the > receiving side, whether that is too much or too little in one receive/send > call. A size header or delimiter (or a constant size) is need to determine > if you have enough to pull a message from the stream, or (as it sounds in > your case), where you should stop reading from the stream for a given > message. > > > > Will > > > > ----- Original Message ----- > > From: "Mark Wallsgrove" <[email protected]> > > To: [email protected] > > Sent: Friday, November 13, 2009 12:08:11 PM GMT -06:00 US/Canada Central > > Subject: Re: Multiple Messages being recieved at the same time.. > > > > Hey, > > > > Thanks for the quick replies. Surely this isn't due to fragmentation? > > Wouldn't fragmentation come down to multiple reads per network packet > > being sent? Which would be fine, but all the messages that are being > > sent fit within a single tcp/ip packet and are being received as a > > single packet. > > > >>>A message is not a "packet". You can have several messages in one > "packet" or several "packets" for one message. > > > > I have one message per packet, and it is received as one packet also.. > > When I view Wireshark it clearly shows a time gap between the two > > receives and the fact the tcp/ip packet isn't full. This isn't a > > problem with it being incomplete, its a problem with it being over > > complete. > > > > From reading the documentation I got the feeling that you have to cope > > with the received data not being complete and not that you have too > > much information. > > > > Best Regards, > > Mark Wallsgrove > > > > 2009/11/13 Mikhail Gerdov <[email protected]>: > >> Nature of TCP/IP lead to the fact that MINA can not guaranty that > >> every Send call will result to exactly one Read call. > >> There are ways to fight it by providing custom Decoder to handle > fragmentation. > >> Please read this: > >> http://mina.apache.org/handling-packet-fragementation.html > >> and look at CumulativeProtocolDecoder examples. > >> > >> > >> > >> On Fri, Nov 13, 2009 at 1:12 PM, Mark Wallsgrove > >> <[email protected]> wrote: > >>> Mina > >> > >> > >> > >> -- > >> Best regards, > >> Mikhail Gerdov mailto: > [email protected] > >> > > > > > > > > -- > > Best Regards, > > Mark Wallsgrove > > > > > > -- > Best Regards, > Mark Wallsgrove >
