mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith McNeill <mcne...@streambase.com>
Subject Re: echo server example
Date Mon, 12 Mar 2007 18:07:10 GMT
I just noticed a similar problem with the proxy example.  Seems to work 
on 1.0 but not on 1.1.  Haven't really looked into it yet to see what 
the problem was.

Keith

Mark Webb wrote:
> Correction on the email.  I can get the linux 'telnet' program to work 
> with
> the EchoServer, but not my program whose code is listed below.
>
>
> On 3/12/07, Mark Webb <elihusmails@gmail.com> wrote:
>>
>> I am trying to get the Echo server example working in the 1.1 branch 
>> with
>> a simple telnet application.  I hope to use this echo server for more 
>> in the
>> near future, but I have run into a problem I can't seem to fix.  I 
>> start up
>> the EchoServer example and telnet to port 8080.  I type in something 
>> like
>> "Hello World", and never get anything back.  I am not sure if this is a
>> problem with the codec, the telnet program or something else.  I even 
>> wrote
>> a simple program that looks like the following:
>>
>> for( ; ; ){
>>
>>                 Socket socket = new Socket( host, port );
>>                 OutputStream out = socket.getOutputStream();
>>                 InputStream in = socket.getInputStream();
>>
>>                 out.write( "Hello World\r\n".getBytes() );
>>                 out.flush();
>>
>>                 int read = 0;
>>                 byte[] buf = new byte[16];
>>                 while( (read = in.read(buf)) != -1 ){
>>                     System.out.println( new String(buf,0,read) );
>>                 }
>>
>>                 socket.close();
>>                 Thread.sleep(1000);
>>             }
>>
>> The problem is that the first call to in.read(buf) works fine.  The 
>> second
>> call hangs and waits for more data.  I am getting this problem without
>> modifying the EchoServer code, so I think I need some help.
>>
>> Thank you.
>>
>>
>
>

Mime
View raw message