You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Cameron Ross <cr...@symboticware.com> on 2005/05/20 21:40:04 UTC

Problem send long to client connected with DatagramAcceptor

Hello,

I'm trying to send a CRC checksum back to a client connected to my 
server throguh a DatagramAcceptor using the following:

long crc = 1234;
ByteBuffer writeBuffer = ByteBuffer.allocate(8);
writeBuffer.putLong(0, crc);
session.write(writeBuffer, null);

The client (written in C) receives 8 bytes as expected, however the 
receive buffer is empty.

Any suggestions?

Cheers,
Cameron Ross.

Re: Problem send long to client connected with DatagramAcceptor

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

2005/5/21, Cameron Ross <cr...@symboticware.com>: 
> 
> Hello,
> 
> I'm trying to send a CRC checksum back to a client connected to my
> server throguh a DatagramAcceptor using the following:
> 
> long crc = 1234;
> ByteBuffer writeBuffer = ByteBuffer.allocate(8);
> writeBuffer.putLong(0, crc);
> session.write(writeBuffer, null);
> 
> The client (written in C) receives 8 bytes as expected, however the
> receive buffer is empty.

 You forgot to flip your buffer before writing it. :)
 Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/