Hey I've been trying socket.connect to see if my server is online or not via android studio, but it seems to timeout always, what am i doing wrong?
Code: SocketAddress sockaddr = new InetSocketAddress(serverIp, 19132); Socket socket = new Socket(); socket.connect(sockaddr, 10000); This is in asynctask in try{}
Try this Code: public boolean isServerOnline(string serverIp){ Socket s = null; try{ s = new Socket(serverIp, port); return true; }catch (Exception e){ return false; } }