Sometimes this happens on my pc as well what usually fixed it was updating the network driver to the previous version not the up to date file no idea why but that does it, I also think sometimes it overheats which messes up the network card usually restarting or turning it off for a few minutes solves the problem if it’s using a specified program try allowing access through windows firewall to it