When this happens it's because the host didn't have the right port open.
Search for "port forwarding" on google. Knowing the model of your router might help.
A quick solution is to enable DMZ for the hosting computer.
If everything fails or seems way too complicated you may use a LAN simulator program like Hamachi or Tunngle.
Just to be safe: if you have a firewall installed make sure it is not blocking the game.