Connection failed - android to editor/standalone

I was doing some simple networking tests, and I found that for some reason I can’t connect my android phone to my pc. I get the “The connection request to 192.168.1.4:22040 failed. Are you sure the server can be connected to?” error on my phone.

I can start a server with my phone and join it with the pc, but not the other way around.

I tried using different ports already. I also tried hosting with both editor and a standalone build.

What am I missing here? :S

I used the code below:

public void HostAny ()
{
	Network.InitializeServer (2, 22040, false);
}
public void ConnectAsPhone ()
{
	Network.Connect ("192.168.1.4", 22040);
}
public void ConnectAsPC ()
{
	Network.Connect ("192.168.1.2", 22040);
}

I found the problem and managed to solve it.

I couldn’t ping my pc from my phone because windows 8.1 doesn’t allow it by default, so I followed the instructions in the link below, and everything works now.

ENABLE PING