Are you using Wi-Fi or a wired connection?
It’s possible that you are connected to a router which has “wireless isolation” turned on. This means that all devices connected to the router can access the internet, but they can’t access each other. Example: WIRELESS, AP OR CLIENT ISOLATION
I can’t think of another solution except logging into your router and turning this setting off.