thanks for reply Grob,

i tried it on both emulator and on my real device (connected to my pc) but i
got the same exception both time
 java.net.ConnectException: 127.0.0.1:8088 <http://127.0.0.1:8000/> -
  Connection refused

i changed the connection to

Socket socket =   new Socket("10.0.2.2" , 8088 );


now i got no route to host exception.

i have a main java class as a server socket (listening on port 8088) running
on same pc which i want to connect to.

i am testing client(android ) and  server on same pc at the moment but
ideally server would be a remote later



On Thu, Jul 16, 2009 at 2:26 PM, Urs Grob <grob....@gmail.com> wrote:

>
> 127.0.0.1 is the device, or the emulator. So as long as you don't have
> a server listening on that port on the emulator/device itself you
> won't be able to connect. If you want to connect to to a server
> running on the host, then you'll have to connect to 10.0.2.2 (or
> something like that)
>
> If already know this then you need to explain a bit more or it will be
> hard to find somebody that can help you.
>
> -- Urs
>
> On Thu, Jul 16, 2009 at 3:13 PM, Zeeshan Muhammad<genx...@gmail.com>
> wrote:
> > Hi Dear,
> >
> > i got the same problem when i run my code below:
> >
> > InetAddress serverAddr = InetAddress.getByName("127.0.0.1");
> > Socket socket =   new Socket(serverAddr , 8088 );
> >
> > i changed the port but same result.
> > anybody help plz
> >
> >
> > On Sat, Apr 18, 2009 at 1:25 AM, Hunter Peress <hunt...@gmail.com>
> wrote:
> >>
> >> I'm getting:java.net.ConnectException: localhost/127.0.0.1:8000 -
> >>                 Connection refused
> >>
> >>
> >> and...i have
> >> <uses-permission  android:name="android.permission.INTERNET" />
> >> declared in my manifest.xml
> >>
> >> What am I missing?
> >>
> >>
> >>
> >
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to