More information: In my latest test run, the encoder/decoder did work successfully. They parsed out my start of message and end of message characters correctly. They are applied to both the acceptor and connector. The messages going to and from the acceptor both are applied correctly. There is no idle timeout applied to either end. No exceptions are caught at either end. I have seen exceptions while attempting to initially set up the encoder/decoder and those were caught--so I know that the exception handling on both ends is there and catches exceptions.
Thanks -----Original Message----- From: Whitener, Winona T. [mailto:[email protected]] Sent: Monday, May 13, 2013 11:58 AM To: [email protected] Subject: RE: Help with NioSocketConnector I'm using the same codec with both the Acceptor and the Connector, so I'm failing to see how this could be the problem. All messages get through from the Acceptor. The first Connector message goes through and then closes the connection. There is already the exceptionCaught in both the server and the client and nothing comes out from either place. I will be continuing to test this today and will post when there is more information. Has anyone else had this happen? Winona -----Original Message----- From: Emmanuel Lécharny [mailto:[email protected]] Sent: Friday, May 10, 2013 4:14 AM To: [email protected] Subject: Re: Help with NioSocketConnector Le 5/9/13 10:47 PM, Whitener, Winona T. a écrit : > Greetings, > > I have a problem. > > I have a MINA installation. I have a NioSocketAcceptor that works > wonderfully. It sends and receives messages. My client is an > NioSocketConnector. It reads all the messages that the NioSocketAcceptor > sends. These messages are various lengths and with various ASCII > characters-so size is not an issue, nor is unprintable characters. > > The NioSocketConnector on my client receives and parses the messages > correctly. However, some of the messages requires some user input-so outside > of the client class and using ioSession.write(message)-and the client class > closes the connection after sending the first response. (Again, various > lengths but no unprintable characters.) The NioSocketAcceptor receives the > first response message, and then recognizes that the client has disconnected. > > I am not seeing any messages-no exceptions-that indicate why the connector is > closing. When I do not try to write the response message, the connection > remains open appropriately. > > ///connector code snip > connector = new NioSocketConnector(); > connector.getSessionConfig().setReadBufferSize(2048); > connector.getSessionConfig().setUseReadOperation(true); > connector.getSessionConfig().setReuseAddress(true); > connector.getSessionConfig().setKeepAlive(true); > > LoggingFilter loggingFilter = new LoggingFilter(); > loggingFilter.setExceptionCaughtLogLevel(LogLevel.DEBUG); > connector.getFilterChain().addLast("logging", loggingFilter); > connector.getFilterChain().addLast("codec", <custom file name>); > ClientHandler handler = new ClientHandler(); > Connector.setHandler(handler); connectFuture = connector.connect(New > InetSocketAddress(address, port)); connectFuture.join(); ioSession = > connectFuture.getSession(); > > ///write > ioSession.write(message); > > I can get the following through: > * > 2013111211781>>>123.123.123.0>>>0.0.0.0>>>ABC>>>21>>>AGG=1=29=299>>>3e8c288afe77ae0f2ae8d2549f90156 > * > 2013>>>05082013111211781>>>123.123.123.0>>>0.0.0.0>>>ABC>>>21>>>AGG=1=29=299>>>3e8c288afe77ae0f2ae8d2549f90156 > * > //05082013121502688>>>123.123.123.0>>>0.0.0.0>>>AGG=1=2=23>>>5ca5905b75c6643bddb64be055c3f236 > * 20130501202445 (but not 2013050**8**1202445) > I am very confused. If I'm in the handler, I can send pre-generated > responses and it isn't a problem. However, I do need the user's input on the > response. > > Am I supposed to be using two acceptors ? (I need to only accept connections > on the server-I don't need to have the client accept sockets.) Do I need > multiple sockets (if so, why does the first message get through)? > > I appreciate any help you can provide. > Winona Whitener > You most certainly have an issue in your codec, and when it throws an exception, the connection will be closed. You can most certainly get some mor einformation by implementing the exceptionCaught event in your IoHandler (on both the server and the client). One thing you can also do is to check your encoder/decoder in isolation, to be sure it works well. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
