private ByteBuffer Read(int i) {

        ByteBuffer out_buf = ByteBuffer.allocate(i);

        byte buf[] = new byte[i];

        int len = 0;

        while (len < i) {
            try {
                len += in_s.read(buf,0,i);

            } catch (Exception e) {
                System.out.println("Read error: " + e);
                try {
                    player_socket.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            } // вывод исключений


        }



        out_buf = ByteBuffer.wrap(buf, 0, i);
        return out_buf;
    }