Here is the discussion between me and David but still solution is out of reach !! :(
############################################################################ Hi, h_errno has the value "TRY_AGAIN" after gethostbyname() returns NULL. h_errno suggets " A temporary error occurred on an authoritative name server. Try again later !! " Thanks! => On Tue, Sep 15, 2009 at 5:24 AM, David Turner <[email protected]> wrote: Try readinf the value of the h_errno variable after gethostbyname() returns NULL. You might also want to try getaddrinfo() which also allows you to perform DNS resolution (though with a difference interface) and see if it changes anything. There is a chance that you're encoutering a subtle bug in the DNS resolver implementation. Can you provide two short source files that reproduce the problem? => On Mon, Sep 14, 2009 at 11:29 AM, murlivala <[email protected]> wrote: But A itself is launched from shell and both A and B are native code ! Since A and B are both written in Native code, B alone is able to work. I'm quite curious that What difference execve() can make which is used in the app A ? I'm not getting any exception, but NULL which is returned by gethostname() in B after being executed from A using execve() .. ! Thanks! =>On Mon, Sep 14, 2009 at 10:25 PM, David Turner <[email protected]> wrote: My understanding is that B is not a real Android application, just a native executable that happens to be installed. When you launch B from an adb shell, you're doing it from the "shell" user/group ID I believe. When you launch it from application A, you launch it from A's own userId/groupId which has less permission that the shell one. the kernel controls permissions based on the UID/GID of processes. =>On Mon, Sep 14, 2009 at 8:03 AM, CodePupil <[email protected]> wrote: Hi, Thanks for the reply but still there is a room for appropriate explanation(s). First let me clarify the problem: Suppose I have test app A which triggers the application B which needs to resolve the remote hostname. Now when I execute B directly from the shell, it works fine. When B is triggered by A using execve(), It fails. If this fails due to less permissions(may be), I don't be able to understand How could it be? If I execute both the apps(A and B)from shell(from # prompt), both should have same permissions. Either both should work or should simply fail. Does Android system itself decide to execute the app giving it less permissions if that app is triggerred using execve() call ? One more thing, If I triggerred my app using system() call, it works FINE ! So now, scene is like this: If B is executed itself # ./B Result -> Works If B is executed by A using system() call # ./A Result -> Works If B is executed by A using execve() call # ./A Result -> Doesn't work -> ?? Looking for better explanation(s) ! Thanks! ############################################################################ On Sep 14, 6:10 pm, David Turner <[email protected]> wrote: > On Mon, Sep 14, 2009 at 6:06 AM, lbcoder <[email protected]> wrote: > > > There are two DNS sets on an android device. > > The "linux" set and the "android" set. > > You can find the DNS servers used by linux by checking the contents > > of /etc/resolv.conf > > The android dns servers can be found by "getprop". > > They do not match. > > The android dns servers are set by dhcp. > > The linux dns servers are more like fallbacks and are set statically. > > This is correct, but it's only an implementation detail that should not > affect typical application developers (even the C library DNS resolver uses > the > system properties to know which DNS servers to talk to), so there should be > no difference between native and VM code when it comes to DNS resolution. > > > > > > > On Sep 14, 2:56 am, CodePupil <[email protected]> wrote: > > > Hi All, > > > > I'm facing strange problem in resolving remote hostname. > > > I have an application which needs to resolve some remote hostname in > > > order to connect to it, and If I start this application using execve() > > > call, the application doesn't resolve hostname, gethostbyname() > > > returns NULL. If I execute the application directly, it's able to > > > resolve the host name but if it's executed using execve() call, it > > > doesn't. > > > Same approach is working fine on Linux machine but on Android platform > > > it's not able to work. > > > > On Linux: > > > execve() -----> application() ------> Works > > > app() -----> Works > > > > On Android: > > > execve() -----> application() ------> Doesn't works -------> ??? > > > app() -----> Works > > > _______________________________________________________________________________ > > > > Could anybody please throw some light on the matter ? > > > > Thanks!- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Discuss" 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-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
