Code example for ConcurrentLinkedQueue

Methods: add

0
		sock = new DatagramSocket();
		packs = new ConcurrentLinkedQueue<DatagramPacket>();
	} 
	 
	public void enque(DatagramPacket pck){
		packs.add(pck);
	} 
	 
	 
	public void run(){ 
		Thread a = new Thread(new Runnable(){
			public void run(){ 
				while(true){ 
					DatagramPacket pack = packs.peek();
					if(pack != null){
						packs.remove();
						byte b[] = pack.getData();
						String s = new String(b);
						System.out.println(s.length() + ":" + s);
						DatagramPacket sendPack = new DatagramPacket(b,b.length,pack.getAddress(),pack.getPort());
Stop searching for code, let great code find you!  Add Codota to your java IDE