public void kiemTraFileChunk(String tenFile, int soLuongChunkToiDa) {
        try {

            socket = new DatagramSocket(Bittorrent.portlisten + port);
            socket.setSoTimeout(3000);

            for (int i = 0; i < Bittorrent.danhSachPeer.size(); i++) {
                
                String duLieuGui = "GET_CHUNK=>" + tenFile + "=>" + soLuongChunkToiDa;
                String dc = Bittorrent.danhSachPeer.get(i).getIpAddresss().getHostAddress();
                sendPacket = new DatagramPacket(duLieuGui.getBytes(), duLieuGui.getBytes().length, 
                        Bittorrent.danhSachPeer.get(i).getIpAddresss(), Bittorrent.portlisten);
                
                try {
                    socket.send(sendPacket);
                    LogFile.Write("Gui yeu cau vi tri file chunks: " + duLieuGui);
                    
                    buffer = new byte[2048];
                    rcvPacket = new DatagramPacket(buffer, buffer.length);
                    socket.receive(rcvPacket);
                    
                    
                    //Lay so file chunk co trong peer
                    //Dinh dang: 192.168.5.20=>1,3,4,
                    String gt = new String(rcvPacket.getData(), 0, rcvPacket.getLength());
                    LogFile.Write("Nhan vi tri file chunks: " + gt);
                    
                    if (gt != null) {
                        Bittorrent.danhSachPeer.get(i).setStatus(true);
                        
                        //Lay dia chi IP
                        String _ip = gt.split("=>")[0];
                        
                        //Lay danh sach chunk id
                        String[] _chunks = gt.split("=>")[1].split(",");
                        
                        //Lay danh sach chunk cua _ip
                        List<Integer> dsChunk = new ArrayList<>();
                        for (int j = 0; j < _chunks.length; j++) 
                        {
                            try 
                            {
                                int chunkID = Integer.parseInt(_chunks[j]);
                                dsChunk.add(chunkID);
                            } catch (Exception ex) {
                            }

                        }
                        
                        //Cap nhat danh sach chunk cho peer
                        for (int j = 0; j < Bittorrent.danhSachPeer.size(); j++) 
                        {
                            String peerIP = Bittorrent.danhSachPeer.get(j).getIpAddresss().getHostAddress();
                            if(_ip.contains(peerIP))
                            {
                                Bittorrent.danhSachPeer.get(j).setDanhSachChunk(dsChunk);
                                break;
                            }
                        }
                        
                    }
                    
                } catch (IOException ex) {
                }
            }
            
            socket.close();
        } catch (SocketException ex) {
            socket.close();
        }
    }