use of com.tvd12.ezyfoxserver.socket.EzySimpleUdpReceivedPacket in project ezyfox-server by youngmonkeys.
the class EzyNioUdpReader method processReadBytes.
private void processReadBytes(DatagramChannel channel) throws Exception {
buffer.clear();
InetSocketAddress address = (InetSocketAddress) channel.receive(buffer);
if (address == null) {
logger.info("has no data in udp channel: {}", channel);
return;
}
int byteCount = buffer.position();
if (byteCount > 0) {
buffer.flip();
byte[] binary = new byte[buffer.limit()];
buffer.get(binary);
EzyUdpReceivedPacket packet = new EzySimpleUdpReceivedPacket(channel, address, binary);
udpDataHandler.fireUdpPacketReceived(packet);
}
}
Aggregations