@ SuppressWarnings ( "SameParameterValue" ) private void assembleAndSendPacket ( Util . PacketType kind , byte [ ] payload , InetAddress destination , int port ) throws IOException { DatagramPacket packet = Util . buildPacket ( kind , ByteBuffer . wrap ( announcementBytes , DEVICE_NAME_OFFSET , DEVICE_NAME_LENGTH ) . asReadOnlyBuffer ( ) , ByteBuffer . wrap ( payload ) ) ; packet . setAddress ( destination ) ; packet . setPort ( port ) ; socket . get ( ) . send ( packet ) ; }
Finish the work of building and sending a protocol packet .