Skip to content

Instantly share code, notes, and snippets.

@normanmaurer
Created June 16, 2014 12:11
Show Gist options
  • Select an option

  • Save normanmaurer/a227a6ce8101516290e1 to your computer and use it in GitHub Desktop.

Select an option

Save normanmaurer/a227a6ce8101516290e1 to your computer and use it in GitHub Desktop.
/**
* Created by crised on 6/15/14.
*/
public class Handler extends ChannelInboundHandlerAdapter{
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
InetSocketAddress ipSocketAddress = new InetSocketAddress("255.255.255.255", 7686);
ByteBuf byteBuf = Unpooled.copiedBuffer("QOTM?", CharsetUtil.UTF_8);
DatagramPacket udpPacket = new DatagramPacket(byteBuf, ipSocketAddress);
ChannelFuture future = ctx.writeAndFlush(udpPacket);
System.out.println(future.isDone());
ctx.close();
System.out.println("bind method ended");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment