You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by peter royal <pr...@apache.org> on 2006/07/09 00:15:38 UTC
Re: DatagramConnector client sample
On Jul 22, 2006, at 11:22 PM, Joao wrote:
> does anyone has a quick sample on how to use datagramConnector in a
> client
> program?
not yet.. but what detail are you interested in?
-pete
--
proyal@apache.org - http://fotap.org/~osi
Re: DatagramConnector client sample
Posted by peter royal <pr...@apache.org>.
On Jul 9, 2006, at 1:45 PM, Joao wrote:
> I read a littlebit more some other code, where I found out how to
> do it.
> Thanks anyway, I will post a UDP example soon. With some minor
> changes in the echo server it works fine with UDP.
Glad you figured it out.. and please do contribute the examples back! :)
-pete
--
proyal@apache.org - http://fotap.org/~osi
Re: DatagramConnector client sample
Posted by Trustin Lee <tr...@gmail.com>.
Hi Joao,
On 7/10/06, Joao <jo...@wireless-networks.com> wrote:
>
> I read a littlebit more some other code, where I found out how to do it.
> Thanks anyway, I will post a UDP example soon. With some minor
> changes in the echo server it works fine with UDP.
Is there any good news? :)
Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
Re: DatagramConnector client sample
Posted by Joao <jo...@wireless-networks.com>.
I read a littlebit more some other code, where I found out how to do it.
Thanks anyway, I will post a UDP example soon. With some minor
changes in the echo server it works fine with UDP.
>
>> On Jul 22, 2006, at 11:22 PM, Joao wrote:
>>> does anyone has a quick sample on how to use datagramConnector in a
>>> client
>>> program?
>>
>> not yet.. but what detail are you interested in?
>>
> How to send datagrams once I do not really have to connect.
> I've got this from one of the samples. The handler sends the message
> in the sample below.
>
> // Set connect timeout.
> IoConnector connector = new SocketConnector();
> ( ( IoConnectorConfig ) connector.getDefaultConfig()
> ).setConnectTimeout( CONNECT_TIMEOUT );
> IoSession session;
> for( ;; )
> {
> try
> {
> ConnectFuture future = connector.connect(
> new InetSocketAddress( HOSTNAME, PORT ),
> new ClientSessionHandler( USE_CUSTOM_CODEC,
> values ) );
> future.join();
> session = future.getSession();
> break;
> }
>
>
> I am kinda messed up on where to write the code to send the udp
> datagram packet.
> Joao,
>> -pete
>>
>>
>> --proyal@apache.org - http://fotap.org/~osi
>>
>>
>>
>
>
Re: DatagramConnector client sample
Posted by Joao <jo...@wireless-networks.com>.
> On Jul 22, 2006, at 11:22 PM, Joao wrote:
>> does anyone has a quick sample on how to use datagramConnector in a
>> client
>> program?
>
> not yet.. but what detail are you interested in?
>
How to send datagrams once I do not really have to connect.
I've got this from one of the samples. The handler sends the message
in the sample below.
// Set connect timeout.
IoConnector connector = new SocketConnector();
( ( IoConnectorConfig ) connector.getDefaultConfig()
).setConnectTimeout( CONNECT_TIMEOUT );
IoSession session;
for( ;; )
{
try
{
ConnectFuture future = connector.connect(
new InetSocketAddress( HOSTNAME, PORT ),
new ClientSessionHandler( USE_CUSTOM_CODEC,
values ) );
future.join();
session = future.getSession();
break;
}
I am kinda messed up on where to write the code to send the udp
datagram packet.
Joao,
> -pete
>
>
> --proyal@apache.org - http://fotap.org/~osi
>
>
>