I have a client on Android and server on c#. The client sends messages to server and it\'s fine. But I need server to send on request list of folders and files in specified
Ok, I found the solution to your problem.
In your c# server where you send the text:
ASCIIEncoding asen = new ASCIIEncoding();
s.Send(asen.GetBytes("The string was recieved by the server."));
s.Close();
Make sure to close the socket here once you send the data. thats why your app would hang. IT was waiting for more input from the server
Also, change to this in Java where you receive
String text = "";
String finalText = "";
while ((text = in.readLine()) != null) {
finalText += text;
}
txt.setText(finalText);
Notice how you're doing 2 readInputs in that loop. The while statement does one.. and setting the text does one.. so you're essentially trying to read 2 lines during one loop. Changing to what i posted above will fix that