Can not connect lo localhot from emulator using socket

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


Sponsored Links
 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
--~--~---------~--~----~------------~-------~--~----~



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,

Oskeol
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Dalvik Specification

Is the Dalvik specification available, I can't seem to find any spec
on the web ?

-Avron

--~--~---------~--~----~------------~-------~--~----~

2. Google blocking phones with specific firmware from the market?

I've been following the hack job some in the G1 community have been
doing with firmware that was obtained from the soon to be released HTC
Saphire phone.  It seems that people who have firmware version 1.5 on
their phones are being blocked from the market and I was wondering if
anyone knows or has heard anything about this?

If this is the case, is there a reason why?  One of the big reasons I
held out for the G1 was to be able to do things like hack the firmware
or add functionality that was not originally there and it would be a
shame if google or some other entity is indeed blocking certain phones
from the market

For those unaware of this firmware, here is the link
http://code.google.com/p/sapphire-port-dream/


Any input regarding this would be appreciated.


~clark
--~--~---------~--~----~------------~-------~--~----~

3. A study of the product develpment in the Android platform at the smart phone industry- Please, fill in the questionnaire for it

4. Android for STB

5. Deleting a full database record in SQLite

6. "Where is the default ringtones present in sdk 1.5"

7. build android emulator under mingw(winxp)