Re: How to check UDP message header length?

2009-01-11 Thread Barrie Treloar
With MINA, how do we send a UDP message in one, and in multiple packets? Well at this point, keep life simple, and let the stack handle it. You just write data and internally stack shall take care of it. For UDP, max data that can be send is 64K. So, if ethernet MTU is 1500, you packet shall

Re: Can't assign requested address

2009-01-11 Thread Barrie Treloar
On Sun, Jan 11, 2009 at 3:33 AM, hezjing hezj...@gmail.com wrote: Hi I encounter the following exception when tried to send an UDP request in sessionCreated(): 16:57:46.674 [NioProcessor-1] WARN o.a.m.filter.logging.LoggingFilter - SENT: HeapBuffer[pos=0 lim=13 cap=13: 0F 04 00 07 00 00 FB

Re: Why ConnectFuture.isConnected() returns true while there there is no server?

2009-01-11 Thread Barrie Treloar
You probably want to go out and buy UNIX(R) Network Programming Volume 1, Third Edition: The Sockets Networking API - or use your Safari account to read it online. Trying to write networking code without understanding the fundamentals is a hard task. And an email list isn't the best way to impart

Re: Eclipse/OSGi classpath issues?

2008-11-13 Thread Barrie Treloar
On Thu, Nov 13, 2008 at 6:35 PM, Johan Haleby [EMAIL PROTECTED] wrote: Are you sure you've imported and exported the correct packages in your manifest files? I've managed to use Mina 1.1.7 and 2.0.0-m3 in OSGi/Eclipse without any problems. In my case I just wrapped the Mina jar in a separate

Re: Eclipse/OSGi classpath issues?

2008-11-13 Thread Barrie Treloar
On Thu, Nov 13, 2008 at 8:24 PM, Johan Haleby [EMAIL PROTECTED] wrote: Wrapping a jar file as an osgi bundle is really quite simple in some cases. If you're using Eclispe just do File New Project... Plug-in Development Plug-in from existing JAR archive and a bundle wrapping the jar file

Re: Eclipse/OSGi classpath issues?

2008-11-13 Thread Barrie Treloar
On Thu, Nov 13, 2008 at 9:06 PM, Johan Haleby [EMAIL PROTECTED] wrote: Eclipse will add the needed headers to the new bundle wrapping the Mina jar. You don't have to change the mina jar file at all. Yes, but I seed my eclipse target directory via maven, so it would be nice if Mina came already

Eclipse/OSGi classpath issues?

2008-11-11 Thread Barrie Treloar
My application is trying to use mina inside an Eclipse RCP. I get the following error: Exception in thread Thread-3 java.lang.NoClassDefFoundError: org/apache/mina/common/ExceptionMonitor at org.apache.mina.common.support.DefaultIoFuture.notifyListener(DefaultIoFuture.java:247)

Re: Packet loss when using MINA UDP

2008-10-28 Thread Barrie Treloar
Are you waiting for the send to complete? You could be writing messages which are failing to be sent.

Re: Packet loss when using MINA UDP

2008-10-28 Thread Barrie Treloar
On Wed, Oct 29, 2008 at 7:29 AM, Dannyy [EMAIL PROTECTED] wrote: Are you waiting for the send to complete? You could be writing messages which are failing to be sent. Oh, I didn't know we could wait for the send to complete. I did make a large enough send buffer for the client though.

Checking a session is created? (see AbstractTrafficControlTest.testSuspendResumeReadWrite)

2008-10-28 Thread Barrie Treloar
I'm a bit worried about the comments in this method for AbstractTrafficControlTest: public void testSuspendResumeReadWrite() throws Exception { ConnectFuture future = connect(port, new ClientIoHandler()); future.awaitUninterruptibly(); IoSession session =

Re: Checking a session is created? (see AbstractTrafficControlTest.testSuspendResumeReadWrite)

2008-10-28 Thread Barrie Treloar
It's a bit tricky : the session can be connected, but the sessionCreated event might not be called yet. As we need to get the 'lock' object which is injected into the session to run the test, we have to wait for the sessionCreated to be executed (because this is the place where this lock is

Re: Writing Unit Tests: Hard to do with Final Classes/Final Methods.

2008-10-24 Thread Barrie Treloar
On Fri, Oct 24, 2008 at 4:39 PM, Johan Haleby [EMAIL PROTECTED] wrote: You could try out PowerMock (www.powermock.org), it allows you to mock final classes/methods easily if you're used to EasyMock. Nice! I will write up some tests then.

WriteFuture.join() hangs if flushSession() channel sends throw Exception

2008-10-22 Thread Barrie Treloar
This is similar to http://issues.apache.org/jira/browse/DIRMINA-412 but from a different cause. DatagramAcceptorDelegate.flush() calls int localWrittenBytes = ch.send(buf.buf(), destination); which can throw IO Exceptions e.g. Network is no longer connected (pulling the ethernet

Re: WriteFuture.join() hangs if flushSession() channel sends throw Exception

2008-10-22 Thread Barrie Treloar
On Wed, Oct 22, 2008 at 6:35 PM, Emmanuel Lecharny [EMAIL PROTECTED] wrote: Barrie Treloar wrote: This is similar to http://issues.apache.org/jira/browse/DIRMINA-412 but from a different cause. DatagramAcceptorDelegate.flush() calls int localWrittenBytes = ch.send(buf.buf

Re: WriteFuture.join() hangs if flushSession() channel sends throw Exception

2008-10-22 Thread Barrie Treloar
So its a real problem and not just a newbie user error? And if it is a real problem, do you think the flush() method should be calling setWritten(false) on IOExceptions. I might check Tcp sockets to see if they are handled differently to Datagrams...