UDP problem sending byte[] 768 bytes

neilson9 neil at liquidlabs.co.uk
Wed Jun 24 15:49:06 EDT 2009


Hi,

Im having a couple of problems sending UDP byte[] > 768K

For example if Im passing 1024bytes the buffer.readIndex does not get
updated. The sender only passes 768 bytes and if I manually set the
readIndex to 768 it sends another 768 bytes on the second send. I would like
to iterate of the byte[] and use the offsets to prevent copying data etc.

Any help appreciated. 
Regards Neil.

For example:
                 byte[] payload = userdata....;
                 
		 channel = (DatagramChannel) b.bind(new InetSocketAddress(0));
		 ChannelBuffer buffer = dynamicBuffer(bytes.length);
		 buffer.writeBytes(bytes);
		 LOGGER.info("Sending:" + bytes.length + " sent:" + buffer.readerIndex());
		 ChannelFuture channelFuture = channel.write(buffer, new
InetSocketAddress(uri.getHost(), port));
                 // manually setting to see if it sends the remainder
		 buffer.readerIndex(768);
		 
		 channelFuture = channel.write(buffer, new
InetSocketAddress(uri.getHost(), port));
		 LOGGER.info("Sending:" + buffer.readerIndex());


-- 
View this message in context: http://n2.nabble.com/UDP-problem-sending-byte---768-bytes-tp3151009p3151009.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list