David, do you have an example for the java code for dalvik vm. Do you use java.net.Socket/ServerSocket or android.net.LocalSocket/LocalServerSocket?
On Friday, March 30, 2012 6:30:12 AM UTC-7, David Given wrote:
Chris Stratton wrote: [...] > There is no requirement that both sockets be in the same process. In > the most common use cases, they they are not.
We're using Unix sockets to communicate between two processes (one side is a Dalvik VM, the other is a daemon process started with fork), and it all works fine.
However, bear in mind that a Java LocalSocketAddress actually refers to an abstract socket address, not a filesystem one --- from the C side, the first byte of the address must be a \0. See the man page.
-- ┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ───── │ "Parents let children ride bicycles on the street. But parents do not │ allow children to hear vulgar words. Therefore we can deduce that │ cursing is more dangerous than being hit by a car." --- Scott Adams
Ajit Kumar wrote:
> David, do you have an example for the java code for dalvik vm. Do you
> use java.net.Socket/ServerSocket or
Sorry, I should have been clearer: both sides of our code are native, so
we're not using Java. I have used androdi.net.LocalSocket in the past
but don't have any code handy, sorry.
(You have to use android.net.LocalSocket as java.net.Socket doesn't
support Unix domain sockets. However... there's nothing to stop you
connecting to localhost if you prefer to use Socket: it's marginally
less efficient than a Unix domain socket, but only very slightly.)
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_