Hi,<div>  I have to jump out and say something.</div><div>  I knew about Netty since a couple of months ago and have implemented success application to handle CLI request, auto-packet-segmentation,  multi-level frame codec, RPC, in distributed system.</div>
<div><br></div><div>  Netty is very neat to use, and here is the steps I adopted it (share it before I ignored):</div><div>1. browse the user guide quickly</div><div>2. run a echo server example and make some modification to get hands-on experience</div>
<div><div>3. read the user guide again, and make notes on it (via pdf editor such as PDF-Xchange or just print it out)</div></div><div>4. write a telnet server, and start to learn the ideas of codec in netty (need to understand Intercepting Filter pattern, which has introduction in MSDN or Oracle)</div>
<div>5. read docs from <a href="http://docs.jboss.org/netty/3.2/api/index.html">http://docs.jboss.org/netty/3.2/api/index.html</a>, and make sure that I have understood following classes ChannelPipeline,ChannelHandler, ChannelEvent,  ChannelHandlerContext,ChannelBuffer)</div>
<div>6. The most important part, when I have question. I write it down (in Evernote), and try best firstly to answer it by own after research. Unlike Microsoft stuff, netty&#39;s source code is exposed to myself,so it is easy to trace down logic flow in code via breakpoints. and watchers.</div>
<div>7. I have not asked question to community now, but will ask if I need to discuss about design or don&#39;t have clue about how to progress in debugging. Just bare in mind, as Netty is opensource, ask self before asking community: is there any further debugging I can do?</div>
<div><br></div><div>Good Luck</div><div>-Xiao</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div class="gmail_quote">On Wed, Oct 12, 2011 at 3:26 AM, metalstorm <span dir="ltr">&lt;<a href="mailto:metalheadstorm@gmail.com">metalheadstorm@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">ok ive tried:<br>
<br>
&#39;ChanneBuffers.wrappedBuffers(byte[])&#39;<br>
<br>
I get corrupted data on the client end.<br>
<br>
using a dynamic buffer<br>
<br>
private final ChannelBuffer buf = new DynamicChannelBuffer(1024 * 8);<br>
<div class="im"><br>
                        FileInputStream in = new FileInputStream(myFile);<br>
<br>
<br>
</div>                        byte[] buffer = new byte[1024 * 8];<br>
<br>
                        int read = 0;<br>
                        int totalRead = 0;<br>
                        System.out.println(&quot;file size: &quot; + myFile.length());<br>
                        while ((read = in.read(buffer, 0, buffer.length)) &gt; 0)<br>
                        {<br>
                                buf.writeBytes(buffer, 0, read);<br>
                                // ch.write(ChannelBuffers.wrappedBuffer(buffer, 0, read));<br>
                                ch.write(buf);<br>
                                totalRead += read;<br>
                                System.out.println(&quot;read: &quot; + read);<br>
                                System.out.println(&quot;totalread: &quot; + totalRead);<br>
<br>
                        }<br>
<br>
which seems to give me double the file on client end, so if the file<br>
contained 1234 i would get 12341234<br>
<br>
im using Normans code with<br>
FileOutputStream out = new FileOutputStream(&quot;fileToSend.txt&quot;, true);<br>
I find it has to be set to true otherwise the file is only 1 buffer size big<br>
<br>
Sample debugging data:<br>
<br>
Server:<br>
<br>
got file: fileToSend.txt<br>
file size: 8206<br>
read: 8192<br>
totalread: 8192<br>
read: 14<br>
totalread: 8206<br>
<br>
Client (line.length):<br>
<br>
has array: 1024<br>
has array: 2048<br>
has array: 2048<br>
has array: 3072<br>
has array: 4096<br>
has array: 4124<br>
<br>
to save your maths, = 16412 = (8206 x 2)<br>
<br>
I don&#39;t see how it receiving 2x the data when on 1 x is sent?<br>
<font color="#888888"><br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Network-file-transfer-tp6875434p6882322.html" target="_blank">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Network-file-transfer-tp6875434p6882322.html</a><br>

</font><div><div></div><div class="h5">Sent from the Netty User Group mailing list archive at Nabble.com.<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><br>
</div></div></blockquote></div><br></div>