示例#1
0
 protected void cycleOperation() {
   if (!socket.isClosed()) {
     try {
       while (!buffer.isEmpty()) {
         DatagramPacket packet = (DatagramPacket) buffer.remove();
         socket.send(packet);
         logger.debug("Sent packet to " + packet.getSocketAddress());
       }
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }
示例#2
0
 public UDPSender() throws SocketException {
   this(SingletonSocket.getInstance(), DatagramBuffer.getSentBuffer());
 }