Created
June 16, 2014 12:41
-
-
Save crised/9df08d48ae861833b9a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OutboundHandler extends ChannelOutboundHandlerAdapter{ | |
@Override | |
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception { | |
System.out.println("Bind happened"); | |
System.out.println(localAddress); | |
InetSocketAddress ipSocketAddress = new InetSocketAddress("255.255.255.255", 7686); | |
ByteBuf byteBuf = Unpooled.copiedBuffer("QOTM?", CharsetUtil.UTF_8); | |
DatagramPacket udpPacket = new DatagramPacket(byteBuf, ipSocketAddress); | |
ctx.write(udpPacket); | |
} | |
@Override | |
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { | |
System.out.println("Write is never called!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment