Question

I am making application in j2me, i am sending data to server

but before that i want to first check that if internet is working or not (it may be from WIFI or GPRS)

Was it helpful?

Solution

Try to use getResponseCode() and getResponseMessage() methods of HttpConnection API .

OTHER TIPS

There's no reliable way to determine if 'the internet is working' other than sending a request to your server. Just because you have a connection to an ISP, it doesn't mean that the ISP has a connection to the internet, or that a packet sent via that connection can reach your server.

The phone might tell you it's not connected, but if you want to know whether you can reach your server when it is connected, send a request and see what happens.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top