Mea culpa. Got the socket example working.
When setting up my project, I hadn't set <uses-permission
android:name="android.permission.INTERNET"/> in the AndroidManifest.xml
(the dangers of making the most stripped-down example possible ... stripped
down too far!)
Sorry for the wild goose chase on that. I'm going to get back to my
original problem and see if the curl/libuv combo works with this permission
set. I will report back on that later.
Regards,
-Mark
On Tuesday, March 24, 2015 at 4:52:18 PM UTC, Mark Simpson wrote:
>
> I've now cross-compiled using a linux machine & gyp. I dropped in the
> binary and have exactly the same outcome as my autotools / os x generated
> binary :-(
>
> My steps were basically:
> - Spin up an aws linux box
> - Pull down the NDK & Android SDK
> - Add them to the path
> - Update the Android SDK
> - Pull down the libuv repo & gyp
> - source ./android-configure /home/ec2-user/downloads/android-ndk-r10d gyp
>
> make -C out
> I've attached the linux & gyp compiled binary in case it's of any use.
>
> Anyway, either I've made mistakes using both os x / linux compile methods,
> or there's a problem in here somewhere. Not quite sure where to go from
> here. Any ideas? If anyone has the hardware to hand, it would be great if I
> could get some independent verification that there's a problem (or I'm
> doing something wrong).
>
> Cheers,
> -Mark
>
> On Tuesday, March 24, 2015 at 2:25:49 PM UTC, Mark Simpson wrote:
>>
>> Sorry, I mean to say that my example returns -13 from *uv_listen *(line
>> 32 of uv_tcp_server.cpp), not uv_tcp_connect.
>>
>> 31 tty("uv tcp listen\n");
>> 32 int r = uv_listen((uv_stream_t*) &server, 10, on_new_connection);
>> // r = -13
>>
>>
>> On Tuesday, March 24, 2015 at 2:19:16 PM UTC, Mark Simpson wrote:
>>>
>>> Here's a tiny Android project that exhibits the problem (see
>>> attachment). It's the android native-plasma sample with everything ripped
>>> out and a handful of libuv calls grabbed from the examples link I posted
>>> earlier. This code works fine on iOS (I can trigger the connect callback).
>>> On android, I just get the -13 return code from *uv_tcp_connect*.
>>>
>>> Probably worth double-checking the Android.mk, but we use similar
>>> settings & linker options for our other projects without an issue. Also, I
>>> have noticed rare SIGILLs in the debugger, but wasn't able to see anything
>>> incriminating on the stack / in the locals pane. I don't use the Android
>>> debugger much and don't tend to trust it a great deal, so not sure how
>>> significant this is. I have checked the libuv.a using readelf to ensure the
>>> format is correct and it looks fine, too.
>>>
>>>
>>>> *$ readelf -h ./libuv.a | grep -i 'class\|machine' | head -2* Class:
>>>> ELF32
>>>> Machine: ARM
>>>
>>>
>>> My colleague and I are going to do the cross compile using linux & gyp
>>> this afternoon, will let you know how we get on.
>>>
>>> Thanks,
>>> -Mark
>>>
>>> On Tuesday, March 24, 2015 at 12:32:38 PM UTC, Mark Simpson wrote:
>>>>
>>>> Hi again Saúl,
>>>>
>>>> In response to your question: I'm using port 12345.
>>>>
>>>> To ensure that I'm not doing anything obviously wrong with my sample
>>>> code, I've created an .h/.cpp containing a tiny amount of socket
>>>> functionality. I call *uv_tcp_connect* from my main function on
>>>> iOS/Android. I can compile & run it on iOS and connect using netcat.
>>>> Running the same code on android results in uv_listen returning -13
>>>> ("Listen error permission denied").
>>>>
>>>> My colleague and I are going to spin up a linux box and compile using
>>>> gyp on linux. If this doesn't work, I'll get back to you with more details
>>>> & a mini project that exhibits the errors I'm seeing.
>>>>
>>>> Thanks
>>>>
>>>> On Monday, March 23, 2015 at 9:44:15 PM UTC, Saúl Ibarra Corretgé wrote:
>>>>>
>>>>> Hi Mark!
>>>>>
>>>>> On 03/23/2015 07:56 PM, Mark Simpson wrote:
>>>>> > Hi,
>>>>> >
>>>>> > Firstly, thanks for the reply & for fixing those warnings.
>>>>> >
>>>>> > In response to your question:
>>>>> > I have tried to use the lib (I mentioned this in the original post,
>>>>> but
>>>>> > should've stated it more prominently) and not much is working. I've
>>>>> > tried three things so far:
>>>>> >
>>>>>
>>>>> Oh, looks like I missed that, sorry!
>>>>>
>>>>> > 1. Running an idle loop that spams to the console
>>>>> >
>>>>> > Result: I can run the idle loop & print stuff just fine.
>>>>> >
>>>>>
>>>>> Ok, basics work then.
>>>>>
>>>>> >
>>>>> > 2. The libuv socket example
>>>>> > (http://nikhilm.github.io/uvbook/networking.html). I'm just
>>>>> creating a
>>>>> > socket server then connecting to it via my mac's terminal & netcat
>>>>> (this
>>>>> > is something we do for our development builds with a non-libuv
>>>>> socket
>>>>> > server, so I'm fairly sure the connection/network configuration is
>>>>> > correct when using nc).
>>>>> >
>>>>> > Result: I can't connect. uv_listen returns -13 (*Listen error
>>>>> > permission denied*).
>>>>> >
>>>>>
>>>>> Are you using a port lower than 1024? Errno 13 is EACCESS.
>>>>>
>>>>> >
>>>>> > 3. A libcurl / libuv test program (basically
>>>>> > this:
>>>>> https://raw.githubusercontent.com/bagder/curl/master/docs/examples/multi-uv.c
>>>>>
>>>>> but
>>>>> > using callbacks for the write -- I have the same example working on
>>>>> iOS)
>>>>> >
>>>>> > Result: Some of the plumbing appears to trigger. The curl socket
>>>>> > callbacks don't trigger, but my requests come through as
>>>>> completing,
>>>>> > but with no valid information (e.g. after I receive
>>>>> > a CURLMSG_DONE message, curl_easy_getinfo(easy_handle, *....*)
>>>>> > doesn't tell me anything, as the out pointers are left
>>>>> unchanged).
>>>>> > I'll dig into debugging this a bit more tomorrow and let you
>>>>> know
>>>>> > what is/isn't triggered.
>>>>> >
>>>>> >
>>>>> > Tomorrow, I will try to cut down my example programs to a bare
>>>>> minimum
>>>>> > then attach them to this thread. Also, do you have any suggestions
>>>>> for
>>>>> > simple scenarios that would aid in diagnosing the problem? If
>>>>> there's
>>>>> > anything I can do to provide better information, I will get onto
>>>>> that
>>>>> > tomorrow.
>>>>> >
>>>>>
>>>>> I'd first try to get a basic TCP server working on Android. AFAIK,
>>>>> libuv
>>>>> does work on it so it might just be a tiny thing we need to tweak.
>>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> --
>>>>> Saúl Ibarra Corretgé
>>>>> bettercallsaghul.com
>>>>>
>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.