Hmm, that&#39;s what I thought but I think I&#39;m using it wrong -- I think the client should use an encoder rather than a decoder, and that the decoder should go in the server.<div><br></div><div>Thanks anyway :)</div><div>

<br></div><div> -- Sébastien<br><br><div class="gmail_quote">2010/11/2 Christian Migowski <span dir="ltr">&lt;<a href="mailto:chrismfwrd@gmail.com">chrismfwrd@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br>
<br>
the use of the DelimiterbasedFrameDecoder ensures that your<br>
messageReceived method only gets complete &quot;frames&quot;, that is lines in<br>
your case. So you don&#39;t need to check and buffer in your<br>
messagereceived method. Also, but I am not 100% sure on this, I would<br>
assume that the framedecoder removes the delimiters from the received<br>
data, so that your code would not work very well anyway.<br>
<br>
regards,<br>
christian!<br>
<br>
<br>
<br>
2010/11/2 Sébastien Pierre &lt;<a href="mailto:sebastien.pierre@gmail.com">sebastien.pierre@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Hi !<br>
&gt; I&#39;ve been using Netty to implement a very simple text-based protocol for a<br>
&gt; log service, where messages are UTF-8 strings like this:<br>
&gt; &lt;LOG_FILE_PATH&gt;:&lt;JSON_ENCODED_MESSAGE_DATA&gt;\n<br>
&gt; For instance<br>
&gt; hello/world.log:&quot;Hello, World&quot;\n<br>
&gt; would append &quot;Hello, World&quot; to the hello/world.log file.<br>
&gt; The problem I have is that it seems that some messages get interwoven,<br>
&gt; basically just as if the server considered two messages as being part of the<br>
&gt; same one, and intermixing both. My problem is then: how do I ensure that<br>
&gt; each message is reliably sent, and that the server does not &quot;interweaves&quot;<br>
&gt; received messages.<br>
&gt; The server is implemented using a ChannelPipelineCoverage(&quot;one&quot;)<br>
&gt; SimpleChannelUpstreamHandler. The message aggregation happens in<br>
&gt; messageReceived, which works like this:<br>
&gt; if message contains &quot;\n&quot;<br>
&gt;    write(buffer)<br>
&gt; else<br>
&gt;   buffer append (message)<br>
&gt; end<br>
&gt;<br>
&gt; with a pipeline setup like this<br>
&gt;<br>
&gt;         p.addLast(&quot;decoder&quot;, new StringDecoder(CharsetUtil.UTF_8));<br>
&gt;<br>
&gt; and the client is implemented with the following decoders<br>
&gt;<br>
&gt;         e.getChannel().getPipeline().addLast(&quot;frameDecoder&quot;, new<br>
&gt; DelimiterBasedFrameDecoder(65535, Delimiters.lineDelimiter()(0),<br>
&gt; Delimiters.lineDelimiter()(1)))<br>
&gt;         e.getChannel().getPipeline().addLast(&quot;encoder&quot;,      new<br>
&gt; StringEncoder(CharsetUtil.UTF_8));<br>
&gt;<br>
&gt; I suppose the problem might be related to the &quot;frameDecoder&quot;, which, to be<br>
&gt; frank, I don&#39;t remember why I used it. So what would be the best setup for a<br>
&gt; high-performance (10+K messages/second) client/server for this simple text<br>
&gt; protocol ? I could use 0MQ for that, but Netty being pure Java, it&#39;s easier<br>
&gt; to deploy.<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt;  -- Sébastien<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; netty-users mailing list<br>
&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;<br>
<br>
_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a></blockquote></div><br></div>