why android says "server failed to communicate"

Thanks a lot pylon, you are right, this time i removed my sim card from mobile and tried, i am getting the right output.

some of the difficulties i faced are,

  1. After getting output, i inserted the sim in mobile and tried, but it was showing the error again.
  2. so i set my mobile in flight mode, and switched ON my wifi alone, and tried again, with fligt mode i am getting the output.
  3. then i off the flight mode and connected to wifi. This time i am getting the output even with the sim functions.

i want the application to run even when the sim is present, so what shold i do for it.

As you haven't provided more information about your network

i cant guess what information you are expecting because i am new to networks, i connected in infra mode with wpa2 security.(is this what u asked)

Does that mean it shows an error on the laptop too?

Never, laptop always shows exact output.