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