Can not connect lo localhot from emulator using socket

by Oskeol » Fri, 09 May 2008 16:01:35 GMT

Sponsored Links
I want to access an Eccho server in localhost.

Here is the Echo server in localhost

import java.util.Scanner;

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

                                InputStream inStream   = 
                                OutputStream outStream = 
                                Scanner in = new Scanner(inStream);
                                PrintWriter out = new PrintWriter(outStream, 
                                out.println("Hello! Enter BYE to exit");

                                boolean done = false;

                                while(!done && in.hasNextLine())
                                        String line = in.nextLine();
                                        out.println("Echo: "+ line);
                                                done = true;


                catch(IOException e)


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

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

Can anybody explain why this happen,


Can not connect lo localhot from emulator using socket

by kobica » Mon, 12 May 2008 17:15:56 GMT


have you tried to forward/redirect ports?
Maybe that is what you are missing.

Plus, take a look at:

Sponsored Links

Can not connect lo localhot from emulator using socket

by Oskeol » Tue, 13 May 2008 20:31:26 GMT

 Thanks, very much for your help.
Forwarding ports it does now work.

Thnx agani Kobi,


Other Threads

1. Is anyone's active install % INCREASING lately?

After all our moaning over the precipitous drop in active install %,
my has gapped upward over the past week from a low of 36% to 44% today
with the biggest gap upward happening on the heels of an update.  (In
the past, the gaps downward would also happen just after an update.)

I wonder if this market stat is finally "fixed", or at least
correcting itself over time.



2. Cryptic ANR trace file from Android Market

I'm analyzing some ANR traces that were reported by users of my
application via Android Market. I have some questions about ANR traces
in general:

How reliable are the traces? Most the traces I have make sense, but
many don't. There is one which doesn't mention any of my code at all,
like it's been created after my application was closed.

Other traces are missing one or more of the permanent threads of my
program. When, and under what circumstances, could a single thread
within a process be killed by the system? Or could my whole
application have been killed, while part of the trace went through
just before?


3. how to save the state of checked item in ListView having Checkbox

4. Fwd: [Hawkboard] Porting On Hawkboard

5. My widget causing ALSA bufffer underrun?

6. Render a number of bitmaps very quickly

7. How to store app data to gmail account? Is it possible?