/**
* @see org.activeio.Channel#write(org.activeio.channel.Packet)
*/
public void write(org.activeio.Packet packet) throws IOException {
ByteSequence sequence = packet.asByteSequence();
DatagramContext context = (DatagramContext) packet.narrow(DatagramContext.class);
if( context!=null ) {
socket.send(new DatagramPacket(sequence.getData(),sequence.getOffset(), sequence.getLength(), context.address, context.port.intValue()));
} else {
socket.send(new DatagramPacket(sequence.getData(),sequence.getOffset(), sequence.getLength()));
}
}