diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java index 4e70ec742f..7384417241 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java @@ -117,7 +117,11 @@ class OioDatagramWorker implements Runnable { ChannelBuffer a = (ChannelBuffer) message; byte[] b = new byte[a.readableBytes()]; a.getBytes(0, b); - channel.socket.send(new DatagramPacket(b, b.length, remoteAddress)); + DatagramPacket packet = new DatagramPacket(b, b.length); + if (remoteAddress != null) { + packet.setSocketAddress(remoteAddress); + } + channel.socket.send(packet); fireWriteComplete(channel, b.length); future.setSuccess(); } catch (Throwable t) {