Android - Phone doesn't respond to ping
I believe this is simply because Android puts the Wifi to sleep to save power when the screen is turned off. You can try setting the Wifi Sleep Policy: Settings > Wireless & Network Setting > Wifi Settings > Press Menu button > Advanced > Wifi sleep policy
to Never
and see if your problem still persists.
Alternatively though, instead of having your server ping your phone, I think it will be easier for the phone to "ping" (or make a HTTP request or through other methods) the server when it is connecting to your Wifi network. Your application can register to the system to receive a broadcast Intent when certain Wifi events occurred.