I am in the process of creating a socket program as well so hopefully we
can help each other.
To start, the readLine() method is deprecated in the DataInputStream and
they suggest to use the BufferedReader class instead. The next problem is
that the readLine() method will keep reading until it finds a line feed ('
\n') or a carriage return ('\r'), That is why it looks like it is not
doing anything because it has not found either characters yet. Try
changing your code to read a character array to something like this:
char dataFromServer[] = new char[1024];
...
...
...
iReceived = in.read(dataFromServer, 0, 1024);
...
...
...
iReceived = the amount of characters actually read (test for -1 as you had
below)
dataFromServer = where to put the characters
0 = offset to start reading at
1024 = total number of characters to read
You will have to adjust your read to either a larger number or loop until
you have all the data. I hope this helps. Let me know if I didn't explain
it correctly or if you need more help.