Sorry, just to answer to emmanuel :
The version I use is Mina 2.0 RC1

On Thu, Aug 5, 2010 at 3:35 PM, Hamid <[email protected]> wrote:

> Hi,
>
> I'll try to describe more my issue.
>
> I've implemented a class handler as below :
>
> public class MyHandler extends IoHandlerAdapter
> {
>    public MyHandler(){
>    //My constructor...
>    }
>
>  public void messageReceived(IoSession session_p, Object message_p)
>     {
>         System.out.println("A new message has been received - "+message_p);
>         ...
>         //Here I have my business process
>     }
>
>   public void exceptionCaught(IoSession session_p, Throwable cause_p)
> throws Exception
>     {
>         System.out.println("Caught exception - "+cause_p.getMessage(),
> cause_p);
>     }
> }
>
> My client program sends the request to the server using the following code
> :
>
> class MyClient{
> NioSocketConnector myConnector = new NioSocketConnector();
> handler = new MyHandler();
> myConnector .setHandler(handler);
> myConnector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new
> MyCodecFactory()));
> // Start the connection
> ConnectFuture conFutur = statusConnector.connect(new
> InetSocketAddress(myRemoteServer,11001));
>
> // Wait for the connection to be established
> conFutur.awaitUninterruptibly();
>
> //Send request
> WriteFututre writer = mySession.write("MyMessage");
> System.out.println("Connection established...");
>
> //Wait few seconds
> boolean isSent = writer.awaitUninterruptibly(10000, TimeUnit.MILLISECONDS);
> System.out.println("Request sent...");
>
> ....
> }
>
> On the console I see that the following logs :
>
> Connection established...
> Request sent...
> Caught exception - The connection was closed....
>
> BUT my Handler doesn't display anything that means that it has been
> called...
>
> I have used a tool to see the data exchanged between my machine and the
> server and I can see the the server has sent the response but the MINA
> handler didn't get it !!
>
> Can you help
> Thanks
> Hamid
>
>
> On Thu, Aug 5, 2010 at 12:12 PM, Emmanuel Lecharny <[email protected]>wrote:
>
>>  On 8/5/10 11:59 AM, Hamid wrote:
>>
>>> Hi everybody,
>>>
>> Hi,
>>
>>
>>  I've implemented a program that defines a simple TCP/IP communication
>>> based
>>> on the MINA framework to connect to an existing TCP/IP server, which is
>>> not
>>> controlled by my self.
>>>
>>> The process is very simple:
>>>
>>> 1. I create a connection to this server using the MINA concept
>>>
>>> 2. I send my request
>>>
>>> 3. The server answers to my request and closes the connection
>>>
>>> 4. When I tried to read the response using my custom decoder, I got the
>>> message "connection closed by a 3rd party....".
>>>
>> Not good ...
>>
>>  The method "messageReceived(IoSession session_p, Object message_p) " in
>>> my
>>> Handler has never been called !
>>>
>> If your decoder has been called, that means the messageReceived has been
>> called.
>>
>>
>>  Just for information, I've implemented the same process using the
>>> classical
>>> Socket mechanism and I succeeded to get the request reply without any
>>> change
>>> on the server side.
>>>
>> No reason it should not work with MINA
>>
>>  I think that the problem comes from the client side
>>>
>> 100% sure. There must be something wrong on the client side.
>>
>>  and maybe from the MINA
>>> framework.
>>>
>> *Very* unlikely.
>>
>> Can someone help me?
>>
>> Sure, if you provide some piece of information about what *exactly* you
>> are trying to do, and more important, *how* you use the framework, and of
>> course, *which* version you are using. Right now, your mail just states that
>> you have an issue using the framework, but don't give any clue about what
>> kind of failure you have.
>>
>> Very like if you call a doctor and tell him 'doctor, I'm sick, can you
>> help me ?' :)
>>
>> --
>> Regards,
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>
>>
>

Reply via email to