rest - Check if RESTful server is available on Android -


i'm developping android rest-api oriented application.

i need create method check whether server available or not. problem if use url.openstream() method, there's no way determine whether request successful or not.

is there way without need operate of performing full httpurlconnection , read return code?

  1. you can use tcp sockets

    socketaddress socketaddress = new inetsocketaddress(address, port); try {     int timeout = 2000;     socket.connect(socketaddress, timeout); } catch (ioexception e) {       return false;  } {     if (socket.isconnected()) {         try {             socket.close();         }         catch (ioexception e) {             e.printstacktrace();         }     } } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -