Hello everyone, I have problem with my simple android chat program when using different test debugging.

I have two android emulators one reads SERVERPORT as 8080 and CLIENTPORT as 8082 and the other android emulator reads SERVERPORT as 8082 and CLIENTPORT as 8080 from a given txt file. Here there is no problem and these two emulators can send text message between them **but when I press connect button before press send button at both 2 emulators ** I connect both of them with each other, after that 5-10 s, I catch exception named java.io.EOFException what would be cause that here the code of server side

if (in == null)
    in = new DataInputStream(socket.getInputStream());

     String line;

                            while ((line = in.readUTF()) != null) {
                                Log.e("Above Sleep ServerActivity", line);
                                Log.d("ServerActivity", line);

                                handler.post(new Runnable() {

                                    public void run() {

                                        text.append("\nServer Activity: "+received_text);

this while line line:6 where I got problem and here the code of client /send button part:


                            if (out == null)
                                out = new DataOutputStream(socket.getOutputStream());

                            Log.i("Client", "Client sent message");
                        catch ...

I found something good working with objects object I/O oparetions over socket, so this topic should be interrupted

This question has already been answered. Start a new discussion instead.