Can I use Linux socket?

149 views
Skip to first unread message

jihoons

unread,
Aug 11, 2009, 9:09:17 AM8/11/09
to android-ndk
I have C++ codes for moblie.

so, I want to use this codes with NDK.
But, Someone told "You can't use linux socket. You must use JNI".
Is it true?

Jack Palevich

unread,
Aug 11, 2009, 12:40:46 PM8/11/09
to andro...@googlegroups.com
You should be able to use the C socket API from the NDK.

However, you may run into permissions issues. For example low TCP/IP
port numbers require root access, and all TCP/IP ports require that
you request Internet access in your AndroidManifest file.

(The networking permission issues are the same for C sockets API and
Java networking APIs -- I'm just mentioning them because people are
often surprised by them.)

Tim Hutt

unread,
Aug 11, 2009, 6:53:22 PM8/11/09
to andro...@googlegroups.com
2009/8/11 Jack Palevich <jac...@google.com>:

>
> You should be able to use the C socket API from the NDK.
>
> However,  you may run into permissions issues. For example low TCP/IP
> port numbers require root access

Speaking of which, I don't think we ever got an answer about if/when
this will be fixed. It is clearly an inappropriate security measure
for a phone (and any other device really).

Doug Schaefer

unread,
Aug 11, 2009, 7:43:08 PM8/11/09
to andro...@googlegroups.com
Given the presence of the Linux kernel, assume never. And whether this is appropriate or not is in the eye of the beholder.

Jack Palevich

unread,
Aug 12, 2009, 12:57:27 PM8/12/09
to andro...@googlegroups.com
If you want to see this behavior changed, please file a feature
request at http://code.google.com/p/android/issues/list (Please search
the existing issues first to see if your issue has already been
reported.)

I know it's more work than just posting on a newsgroup discussion, but
it's our standard way of collecting feature requests and bug reports.

ivan

unread,
Aug 13, 2009, 12:42:15 PM8/13/09
to android-ndk
I'm interested in creating a custom DatagramSocket Implementation
(i.e. extending java.net.DatagramSocketImpl)

I'm assuming to implement functions such as bind, send, etc... I'll
have to use some preexisting native code.

Any recommendations?

Thanks.

On Aug 12, 10:57 am, Jack Palevich <jack...@google.com> wrote:
> If you want to see this behavior changed, please file a feature
> request athttp://code.google.com/p/android/issues/list(Please search
> the existing issues first to see if your issue has already been
> reported.)
>
> I know it's more work than just posting on a newsgroup discussion, but
> it's our standard way of collecting feature requests and bug reports.
>
> On Tue, Aug 11, 2009 at 3:53 PM, Tim Hutt<tdh...@gmail.com> wrote:
>
> > 2009/8/11 Jack Palevich <jack...@google.com>:
Reply all
Reply to author
Forward
0 new messages