After rewriting my protocol request decoder I was still having problems only receiving 4k this time. Looking at the actual traffic with tcpdump/wireshark I saw virtually no traffic, turns out I did not realize session.write() is asynchronous, if I wait on the WriteFuture I get all the data server side. Things are looking much better now!
Thanks again Peter ----- Original Message ---- From: Peter <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, June 2, 2008 10:28:08 AM Subject: Re: unable to send large files with MINA Thanks Niklas. I looked into StreamWriteFilter, seems simple enough to add to my client side to write InputStreams but how do I handle these on the server side? Currently the InputStream data is going to my CumulativeProtocolDecoder, I assume I need to add another filter on the server side to capture this data? I'm not sure how this filter would delimit the binary protocol data from the binary file data though, which was easy to do when everything was in my protocol. Still curious why CumulativeProtocolDecoder doesn't work for larger files. Thanks Peter ----- Original Message ---- From: Niklas Therning <[EMAIL PROTECTED]> To: [email protected] Sent: Sunday, June 1, 2008 11:35:33 PM Subject: Re: unable to send large files with MINA Have you had a look at StreamWriteFilter/FileRegionFilter? I think those are the best for writing large files. Just put the one you prefer AFTER your ProtocolCodecFilter in the filter chain. Once you've done that you can write InputStream/FileRegion objects using IoSession.write(). I think FileRegionFilter only exists in MINA 2.0. MINA 1.x includes the StreamWriteFilter. HTH /Niklas Peter skrev: > Hi > > I'm brand new to MINA. I've come up with a protocol which includes file > attachments. I'm extending the CumulativeProtocolDecoder as per the > ImageDecoder example in the documentation. It works fine for small files but > I am unable to send a 1.5MB file, it never gets further than around 320 - > 330k (varies every time). Without going into too much further detail, here > are some log excerpts from my application. I log every time I enter doDecode > and return false in doDecode(): > > 2008-05-30 16:18:05,903 DEBUG > [org.apache.mina.filter.executor.ExecutorFilter] - Launching thread for > /192.168.1.211:60859 > 2008-05-30 16:18:05,906 DEBUG [protocol.RequestDecoder] - receiving new > request, remaining bytes: 1024 > 2008-05-30 16:18:05,910 DEBUG [protocol.RequestDecoder] - received command > DEPLOY > 2008-05-30 16:18:05,911 WARN [protocol.RequestDecoder] - not enough data > remaining [1018] we need [1456607] > 2008-05-30 16:18:05,912 DEBUG [protocol.RequestDecoder] - receiving new > request, remaining bytes: 3066 > 2008-05-30 16:18:05,912 WARN [protocol.RequestDecoder] - on returning call, > still not enough data remaining [3066] we need [1456607] > . > . > . > 2008-05-30 16:18:05,962 WARN [protocol.RequestDecoder] - on returning call, > still not enough data remaining [308058] we need [1456607] > 2008-05-30 16:18:05,962 DEBUG [protocol.RequestDecoder] - receiving new > request, remaining bytes: 311970 > 2008-05-30 16:18:05,962 WARN [protocol.RequestDecoder] - on returning call, > still not enough data remaining [311970] we need [1456607] > 2008-05-30 16:18:05,963 DEBUG [protocol.RequestDecoder] - receiving new > request, remaining bytes: 327126 > 2008-05-30 16:18:05,963 WARN [protocol.RequestDecoder] - on returning call, > still not enough data remaining [327126] we need [1456607] > 2008-05-30 16:18:05,963 DEBUG > [org.apache.mina.filter.executor.ExecutorFilter] - Exiting since queue is > empty for /192.168.1.211:60859 > > I was wondering if MINA is suited for this kind of application and if there's > any inherit size limit in CumulativeProtocolDecoder. I run this with 1GB heap > size and 256M max direct buffer size. Does anyone have any insights? > > Thanks > Peter >
