Hi,
I want to access an Eccho server in localhost.

Here is the Echo server in localhost




import java.net.*;
import java.io.*;
import java.util.Scanner;


public class EchoServer
{
        public static void main(String[] args)
        {
                try
                {
                        ServerSocket s = new ServerSocket(8189);
                        Socket incoming = s.accept();

                        try
                        {
                                InputStream inStream   = 
incoming.getInputStream();
                                OutputStream outStream = 
incoming.getOutputStream();
                                Scanner in = new Scanner(inStream);
                                PrintWriter out = new PrintWriter(outStream, 
true);
                                out.println("Hello! Enter BYE to exit");

                                boolean done = false;

                                while(!done && in.hasNextLine())
                                {
                                        String line = in.nextLine();
                                        out.println("Echo: "+ line);
                                        if(line.trim().equalsIgnoreCase("BYE"))
                                                done = true;
                                }

                        }
                        finally
                        {
                                incoming.close();
                        }

                }
                catch(IOException e)
                {
                        e.printStackTrace();
                }

    }
}


I have a client, on the emulatot that tries to connect to this server.
I use 10.0.2.2 to connect to localhost, but it doesn't work.

Socket s = new Socket("10.0.2.2", 8189);

Can anybody explain why this happen,

oskeol
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to