You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Ahmed Al-Obaidy <ah...@yahoo.com> on 2007/07/09 09:19:44 UTC

Windows Telnet and GPRS clients

Hi guys,

I'm using MINA to develop a GPRS gateway for an AVL system...

Now I'm using a very simple program for evaluation purpose ...
It just print messages come from TCP clients to the System.out

Tests works OK under Linux/telnet...

When I use it under Windows/Telnet I find a strange behavior  showed up...
The telnet window doesn't echo my input... and the program output log each character separately... but the  IoHandlerAdapter still capture the messages events....
the output seems like this:

Tracking Gateway server started.
20578 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler - [/127.0.0.1:1237] CREATED
20578 [AnonymousIoService-1] INFO ConnHandler - [/127.0.0.1:1237] OPENED
23922 [AnonymousIoService-2] INFO ConnHandler - [/127.0.0.1:1237] RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 68]
24172 [AnonymousIoService-3] INFO ConnHandler - [/127.0.0.1:1237] RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 69]
27781 [AnonymousIoService-4] INFO ConnHandler - [/127.0.0.1:1237] RECEIVED: HeapBuffer[pos=0 lim=2 cap=8192: 0D 0A]
Message
ST:hi


Even more, when tracking devices connect the server... the messages appear in the Log.. but the IoHandlerAdapter never catch the messages events...
the output look like this

Tracking Gateway server started.
57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler - [/213.139.63.254:3599] CREATED
57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599] OPENED
58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599] RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599] RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
98672 [AnonymousIoService-4] INFO ConnHandler - [/213.139.63.254:3599] RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 31 3A 30 39 20 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]

here is my IoHandlerAdapter  

 import java.util.*;
import org.apache.mina.common.IoHandlerAdapter;
import org.apache.mina.common.IoSession;
import org.apache.mina.common.*;
import org.apache.mina.transport.socket.nio.*;

public class ConnHandler extends IoHandlerAdapter {
    //private Map sessions=Collections.synchronizedMap(new HashMap());

    public void exceptionCaught(IoSession session, Throwable t) throws Exception {
        t.printStackTrace();
        session.close();
    }

    public void messageReceived(IoSession session, Object msg) throws Exception {
        System.out.println("Message");
        String str = msg.toString();

        //foreach (IoSession s in sessions.)
        
        //session.write( "You said:" + str );
        System.out.println("ST:"+str);
    }
}

I think the problem has something to do with the charset... I tried many but no success...


       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.

Re: Windows Telnet and GPRS clients

Posted by Jeroen Brattinga <je...@gmail.com>.
If you're using HyperTerminal (hypertrm) you might want to check out the 
ASCII Setup (File --> Properties --> Settings tab --> ASCII Setup. The 
first two options may be what you're looking for.

Jeroen Brattinga


Eero Nevalainen wrote:
> <clipped huqe quotes away>
>
> Ahmed Al-Obaidy wrote:
>>> Even more, when tracking devices connect the server... the messages 
>>> appear
>>> in the Log.. but the IoHandlerAdapter never catch the messages 
>>> events...
>>> the output look like this
>>>
>>> Tracking Gateway server started.
>>> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
>>> [/213.139.63.254:3599] CREATED
>>> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
>>> OPENED
>>> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 
>>> 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 
>>> 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 
>>> 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 
>>> 37 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>>> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 
>>> 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 
>>> 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 
>>> 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 
>>> 39 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>
> Well the hexdump only shows the 'carriage return' character at the 
> end(CR 0x0D) so my guess is the textlinedecoder is still waiting for 
> the 'line feed' character (LF 0x0A).
>
> -Eero Nevalainen
>

Re: Windows Telnet and GPRS clients

Posted by Ahmed Al-Obaidy <ah...@yahoo.com>.
Thanks Eero... 

I wrote a new ProtocolCodecFactory... very similar to TextLineCodecFactory...

the constructor became like this:

    public RtuTextCodecFactory( Charset charset )
    {
        encoder = new TextLineEncoder( charset, new LineDelimiter("\r"));
        decoder = new TextLineDecoder( charset, new LineDelimiter("\r") );
    }
 
and its working now...
thanks alot


Eero Nevalainen <ee...@indagon.com> wrote: You can tell TextLineEncoder and TextLineDecoder to use any 
LineDelimiter you need. TextLineCodecFactory just wraps these two up and 
implements the ProtocolCodecFactory interface.
(just two methods, getEncoder() and getDecoder())

-Eero Nevalainen

Ahmed Al-Obaidy wrote:
> So what you are suggesting...
> 
> can I tell TextLineCodecFactory to use different LineDelimiter?? or should I write new codec from scratch??
> 
> Eero Nevalainen  wrote: 
> 
> Ahmed Al-Obaidy wrote:
>>> Even more, when tracking devices connect the server... the messages appear
>>> in the Log.. but the IoHandlerAdapter never catch the messages events...
>>> the output look like this
>>>
>>> Tracking Gateway server started.
>>> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
>>> [/213.139.63.254:3599] CREATED
>>> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
>>> OPENED
>>> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>>> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 
> Well the hexdump only shows the 'carriage return' character at the 
> end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
> 'line feed' character (LF 0x0A).
> 
> -Eero Nevalainen
> 
> 
>        
> ---------------------------------
> Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.



       
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 
 
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

Re: Windows Telnet and GPRS clients

Posted by Eero Nevalainen <ee...@indagon.com>.
You can tell TextLineEncoder and TextLineDecoder to use any 
LineDelimiter you need. TextLineCodecFactory just wraps these two up and 
implements the ProtocolCodecFactory interface.
(just two methods, getEncoder() and getDecoder())

-Eero Nevalainen

Ahmed Al-Obaidy wrote:
> So what you are suggesting...
> 
> can I tell TextLineCodecFactory to use different LineDelimiter?? or should I write new codec from scratch??
> 
> Eero Nevalainen <ee...@indagon.com> wrote: 
> 
> Ahmed Al-Obaidy wrote:
>>> Even more, when tracking devices connect the server... the messages appear
>>> in the Log.. but the IoHandlerAdapter never catch the messages events...
>>> the output look like this
>>>
>>> Tracking Gateway server started.
>>> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
>>> [/213.139.63.254:3599] CREATED
>>> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
>>> OPENED
>>> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>>> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
>>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
>>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 
> Well the hexdump only shows the 'carriage return' character at the 
> end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
> 'line feed' character (LF 0x0A).
> 
> -Eero Nevalainen
> 
> 
>        
> ---------------------------------
> Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.


Re: Windows Telnet and GPRS clients

Posted by Ahmed Al-Obaidy <ah...@yahoo.com>.
So what you are suggesting...

can I tell TextLineCodecFactory to use different LineDelimiter?? or should I write new codec from scratch??

Eero Nevalainen <ee...@indagon.com> wrote: 

Ahmed Al-Obaidy wrote:
>> Even more, when tracking devices connect the server... the messages appear
>> in the Log.. but the IoHandlerAdapter never catch the messages events...
>> the output look like this
>>
>> Tracking Gateway server started.
>> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
>> [/213.139.63.254:3599] CREATED
>> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
>> OPENED
>> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]

Well the hexdump only shows the 'carriage return' character at the 
end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
'line feed' character (LF 0x0A).

-Eero Nevalainen


       
---------------------------------
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.

Re: Windows Telnet and GPRS clients

Posted by Eero Nevalainen <ee...@indagon.com>.
<clipped huqe quotes away>

Ahmed Al-Obaidy wrote:
>> Even more, when tracking devices connect the server... the messages appear
>> in the Log.. but the IoHandlerAdapter never catch the messages events...
>> the output look like this
>>
>> Tracking Gateway server started.
>> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
>> [/213.139.63.254:3599] CREATED
>> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
>> OPENED
>> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
>> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
>> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
>> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
>> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
>> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]

Well the hexdump only shows the 'carriage return' character at the 
end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
'line feed' character (LF 0x0A).

-Eero Nevalainen

Re: Windows Telnet and GPRS clients

Posted by Ahmed Al-Obaidy <ah...@yahoo.com>.
Hi Maarten...
here is my server 

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.charset.*;
import org.apache.mina.common.IoAcceptor;
import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.transport.socket.nio.*;
import org.apache.mina.common.*;
import org.apache.mina.filter.*;
import org.apache.mina.filter.codec.*;
import org.apache.mina.filter.codec.textline.*;

import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.mina.integration.jmx.IoServiceManager;

public class Main {
    private static final int PORT = 6082;
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        ByteBuffer.setUseDirectBuffers(false);
        ByteBuffer.setAllocator(new SimpleByteBufferAllocator());

        IoAcceptor acceptor = new SocketAcceptor();

        
        SocketAcceptorConfig  cfg = new SocketAcceptorConfig();
        cfg.getSessionConfig().setReuseAddress( true );
        cfg.getFilterChain().addLast( "logger", new LoggingFilter() );
        cfg.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));

        IoServiceManager serviceManager = new IoServiceManager( acceptor );
        serviceManager.startCollectingStats(1000);
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        
        try {
            ObjectName name = new ObjectName("com.jels.kaddb.gateway:type=IoServiceManager");
            mbs.registerMBean(serviceManager, name);

            acceptor.bind( new InetSocketAddress(PORT), new ConnHandler(), cfg);
        }
        catch (Exception e) {
            
        }
        
        System.out.println("Tracking Gateway server started.");        
    }
    
    public void sessionCreated(IoSession session) throws Exception {
        System.out.println("Session created...");

    }


}

I tired  US_ASCII, ISO-8859-1 and UTF-8 for charset and same problem appeared ** I use mina-core-1.1.0.jar

Thanks in advance 

Maarten Bosteels <mb...@gmail.com> wrote: Hi Ahmed,

Could you show us how you set up the server ?
Which ExecutorFilter and ProtocolCodecFilter you use, etc..

Thanks,
Maarten

On 7/9/07, Ahmed Al-Obaidy  wrote:
>
> Hi guys,
>
> I'm using MINA to develop a GPRS gateway for an AVL system...
>
> Now I'm using a very simple program for evaluation purpose ...
> It just print messages come from TCP clients to the System.out
>
> Tests works OK under Linux/telnet...
>
> When I use it under Windows/Telnet I find a strange behavior  showed up...
> The telnet window doesn't echo my input... and the program output log each
> character separately... but the  IoHandlerAdapter still capture the messages
> events....
> the output seems like this:
>
> Tracking Gateway server started.
> 20578 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler - [/127.0.0.1:1237]
> CREATED
> 20578 [AnonymousIoService-1] INFO ConnHandler - [/127.0.0.1:1237] OPENED
> 23922 [AnonymousIoService-2] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 68]
> 24172 [AnonymousIoService-3] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 69]
> 27781 [AnonymousIoService-4] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=2 cap=8192: 0D 0A]
> Message
> ST:hi
>
>
> Even more, when tracking devices connect the server... the messages appear
> in the Log.. but the IoHandlerAdapter never catch the messages events...
> the output look like this
>
> Tracking Gateway server started.
> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
> [/213.139.63.254:3599] CREATED
> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
> OPENED
> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 98672 [AnonymousIoService-4] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 31 3A 30 39 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>
> here is my IoHandlerAdapter
>
> import java.util.*;
> import org.apache.mina.common.IoHandlerAdapter;
> import org.apache.mina.common.IoSession;
> import org.apache.mina.common.*;
> import org.apache.mina.transport.socket.nio.*;
>
> public class ConnHandler extends IoHandlerAdapter {
>     //private Map sessions=Collections.synchronizedMap(new HashMap());
>
>     public void exceptionCaught(IoSession session, Throwable t) throws
> Exception {
>         t.printStackTrace();
>         session.close();
>     }
>
>     public void messageReceived(IoSession session, Object msg) throws
> Exception {
>         System.out.println("Message");
>         String str = msg.toString();
>
>         //foreach (IoSession s in sessions.)
>
>         //session.write( "You said:" + str );
>         System.out.println("ST:"+str);
>     }
> }
>
> I think the problem has something to do with the charset... I tried many
> but no success...
>
>
>
> ---------------------------------
> Looking for a deal? Find great prices on flights and hotels with Yahoo!
> FareChase.


       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
 
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.

Re: Windows Telnet and GPRS clients

Posted by Maarten Bosteels <mb...@gmail.com>.
Hi Ahmed,

Could you show us how you set up the server ?
Which ExecutorFilter and ProtocolCodecFilter you use, etc..

Thanks,
Maarten

On 7/9/07, Ahmed Al-Obaidy <ah...@yahoo.com> wrote:
>
> Hi guys,
>
> I'm using MINA to develop a GPRS gateway for an AVL system...
>
> Now I'm using a very simple program for evaluation purpose ...
> It just print messages come from TCP clients to the System.out
>
> Tests works OK under Linux/telnet...
>
> When I use it under Windows/Telnet I find a strange behavior  showed up...
> The telnet window doesn't echo my input... and the program output log each
> character separately... but the  IoHandlerAdapter still capture the messages
> events....
> the output seems like this:
>
> Tracking Gateway server started.
> 20578 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler - [/127.0.0.1:1237]
> CREATED
> 20578 [AnonymousIoService-1] INFO ConnHandler - [/127.0.0.1:1237] OPENED
> 23922 [AnonymousIoService-2] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 68]
> 24172 [AnonymousIoService-3] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=1 cap=8192: 69]
> 27781 [AnonymousIoService-4] INFO ConnHandler - [/127.0.0.1:1237]
> RECEIVED: HeapBuffer[pos=0 lim=2 cap=8192: 0D 0A]
> Message
> ST:hi
>
>
> Even more, when tracking devices connect the server... the messages appear
> in the Log.. but the IoHandlerAdapter never catch the messages events...
> the output look like this
>
> Tracking Gateway server started.
> 57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
> [/213.139.63.254:3599] CREATED
> 57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
> OPENED
> 58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
> 98672 [AnonymousIoService-4] INFO ConnHandler - [/213.139.63.254:3599]
> RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
> 34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
> 30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
> 30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 31 3A 30 39 20
> 30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
>
> here is my IoHandlerAdapter
>
> import java.util.*;
> import org.apache.mina.common.IoHandlerAdapter;
> import org.apache.mina.common.IoSession;
> import org.apache.mina.common.*;
> import org.apache.mina.transport.socket.nio.*;
>
> public class ConnHandler extends IoHandlerAdapter {
>     //private Map sessions=Collections.synchronizedMap(new HashMap());
>
>     public void exceptionCaught(IoSession session, Throwable t) throws
> Exception {
>         t.printStackTrace();
>         session.close();
>     }
>
>     public void messageReceived(IoSession session, Object msg) throws
> Exception {
>         System.out.println("Message");
>         String str = msg.toString();
>
>         //foreach (IoSession s in sessions.)
>
>         //session.write( "You said:" + str );
>         System.out.println("ST:"+str);
>     }
> }
>
> I think the problem has something to do with the charset... I tried many
> but no success...
>
>
>
> ---------------------------------
> Looking for a deal? Find great prices on flights and hotels with Yahoo!
> FareChase.