This might help you 
http://stackoverflow.com/questions/7516018/android-localserversocket

-Mika

On Jun 7, 4:45 am, galapogos <[email protected]> wrote:
> Thanks. Seems like 127.0.0.1 works. I also tried 0.0.0.0 and that worked
> too.
>
> I would also like to use unix domain sockets, since I really only want the
> 2 processes talking to each other rather than any external devices talking
> to my device. However, when I change AF_INET to AF_UNIX in the socket()
> call in my server and client, I get run time "Invalid argument" errors on
> bind() and connect() respectively.
>
> How do I make the switch to unix domain sockets? What am I missing?
>
>
>
>
>
>
>
> On Wednesday, June 6, 2012 11:13:07 PM UTC+8, Chris Stratton wrote:
>
> > On Jun 6, 8:34 am, Tony Houghton <[email protected]> wrote:
>
> > > 10.0.2.2 is a special address so that apps in an emulator can connect to
> > > services on the host running the emulator. AIUI your service is running
> > > on the same Android device as the client so I think you want 127.0.0.1.
>
> > Yes.  Not only is the special address the wrong computer, it's unique
> > to emulators and not available on real devices.  If using a network
> > socket, loopback is the answer.
>
> > However, unless you absolutely have to emulate IP networking, it may
> > be preferable to use a unix-domain socket rather than a network one.
> > This will remove the requirement that any apk using it carry internet
> > permission, while keeping many of the semantics comparable.
>
> > While unix domain sockets aren't the first choice for IPC within
> > android (that would be Binder) they definitely are used within android
> > itself, for example the connection between the adb daemon and a
> > debuggable app process which makes java debugging possible is done via
> > a unix socket.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to