You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Martin J. Wells" <ma...@dot.net.au> on 2005/05/23 09:49:45 UTC

[mina] c# client

Hi guys,

I'm looking to implement a c# client for a MINA server and was wondering
where I can find some info on the message protocol used. I.e.. how are
message lengths interpreted, is there a magic number header, etc. Can't seem
to locate much in the source... Am I missing something?

Regards,
Marty


RE: [mina] c# client

Posted by "Martin J. Wells" <ma...@dot.net.au>.
Aaah, nevermind... I discovered the wonder that is the
CumulativeProtocolDecoder. :)
 
 

  _____  

From: Martin J. Wells [mailto:marty@dot.net.au] 
Sent: Monday, 23 May 2005 6:02 PM
To: 'Apache Directory Developers List'
Subject: RE: [mina] c# client


OK. But then how does the message protocol handler know when a message is
done? How do you know you've actually received all the data for a discreet
message?
 
If the answer is this is not handled by default then how is this typically
done in MINA... how do you hold onto inbound client data until a full
message is ready? For example:
 

public class ReverseProtocolHandler extends ProtocolHandlerAdapter

{

    ...
    public void messageReceived( ProtocolSession session,

Object message )

    {

        // Reverse reveiced string

        String str = message.toString();

        StringBuffer buf = new StringBuffer( str.length() );

        for( int i = str.length() - 1; i >= 0; i-- )

        {

            buf.append( str.charAt( i ) );

        }



        // and write it back.

        session.write( buf.toString() );

    }

}
I can test in here whether all the data is available, but if I don't have
the entire message do I have to then implement my own per-client message
buffering?
 
 
 

  _____  

From: Trustin Lee [mailto:trustin@gmail.com] 
Sent: Monday, 23 May 2005 5:56 PM
To: Apache Directory Developers List
Subject: Re: [mina] c# client


Hi Martin,


2005/5/23, Martin J. Wells <ma...@dot.net.au>: 

I'm looking to implement a c# client for a MINA server and was wondering
where I can find some info on the message protocol used. I.e.. how are
message lengths interpreted, is there a magic number header, etc. Can't seem
to locate much in the source... Am I missing something?

 
MINA itself doesn't implement any protocols.  It simply helps you to
implement your or any others' protocols.  If any protocol specification is
not defined, you'll have to define some first, and then implement the server
to conform to that specifiation, and MINA will help you implementing it.
So.. if you're implementing C# client for a server which is made on top of
MINA, actually it dosn't matter whether the server is implemented using MINA
or any other frameworks. 
 
Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/ 


RE: [mina] c# client

Posted by "Martin J. Wells" <ma...@dot.net.au>.
OK. But then how does the message protocol handler know when a message is
done? How do you know you've actually received all the data for a discreet
message?
 
If the answer is this is not handled by default then how is this typically
done in MINA... how do you hold onto inbound client data until a full
message is ready? For example:
 
public class ReverseProtocolHandler extends ProtocolHandlerAdapter

{

    ...


    public void messageReceived( ProtocolSession session,

Object message )

    {

        // Reverse reveiced string

        String str = message.toString();

        StringBuffer buf = new StringBuffer( str.length() );

        for( int i = str.length() - 1; i >= 0; i-- )

        {

            buf.append( str.charAt( i ) );

        }



        // and write it back.

        session.write( buf.toString() );

    }

}
I can test in here whether all the data is available, but if I don't have
the entire message do I have to then implement my own per-client message
buffering?
 
 
 

  _____  

From: Trustin Lee [mailto:trustin@gmail.com] 
Sent: Monday, 23 May 2005 5:56 PM
To: Apache Directory Developers List
Subject: Re: [mina] c# client


Hi Martin,


2005/5/23, Martin J. Wells <ma...@dot.net.au>: 

I'm looking to implement a c# client for a MINA server and was wondering
where I can find some info on the message protocol used. I.e.. how are
message lengths interpreted, is there a magic number header, etc. Can't seem
to locate much in the source... Am I missing something?

 
MINA itself doesn't implement any protocols.  It simply helps you to
implement your or any others' protocols.  If any protocol specification is
not defined, you'll have to define some first, and then implement the server
to conform to that specifiation, and MINA will help you implementing it.
So.. if you're implementing C# client for a server which is made on top of
MINA, actually it dosn't matter whether the server is implemented using MINA
or any other frameworks. 
 
Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/ 


Re: [mina] c# client

Posted by Trustin Lee <tr...@gmail.com>.
Hi Martin,

2005/5/23, Martin J. Wells <ma...@dot.net.au>: 
> 
> I'm looking to implement a c# client for a MINA server and was wondering
> where I can find some info on the message protocol used. I.e.. how are
> message lengths interpreted, is there a magic number header, etc. Can't 
> seem
> to locate much in the source... Am I missing something?

 MINA itself doesn't implement any protocols. It simply helps you to 
implement your or any others' protocols. If any protocol specification is 
not defined, you'll have to define some first, and then implement the server 
to conform to that specifiation, and MINA will help you implementing it. 
So.. if you're implementing C# client for a server which is made on top of 
MINA, actually it dosn't matter whether the server is implemented using MINA 
or any other frameworks.
 Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/