I have below code which throws SocketTimeoutException.
Socket socket = new Socket(localhost, 9978);
socket.setSoTimeout(10000);
OutputStream oStream= socket.getOutputStream();
byte[] data = new byte[] {'h', 'e', 'l', 'l', 'o'};
oStream.write(data);
oStream.flush();
DataInputStream iStream = new DataInputStream(socket.getInputStream());
final byte[] received = new byte[data.length];
data.readFully(received);
At readFully, I get SocketTimeoutException. So, certainly i have wrong code but I am not sure what.
Thanks for the help.