socket client is running on android:
try {
socketClient = new Socket(host, port);
//set socket input
in = socketClient.getInputStream();
dIn = new DataInputStream(in);
//set socket output
out = socketClient.getOutputStream();
dOut = new DataOutputStream(out);
int c = 0;
String data = "";
while ((c = dIn.read()) != -1) {
//print data
}
} catch (Exception e) {
//close connection
}
my server run on python and everything is works fine except until the server is not running and when i try to connect to server it takes two minutes to catch the error that the server is not available
How can I reduce the time for example catch the error in 10 sec