java.net.BindException: Permissions do not allow action on socket

by sharon....@gmail.com » Sat, 14 Mar 2009 14:56:30 GMT


Sponsored Links
 I can not find answer from android-disc...@googlegroups.com, so post
here again.

The java.net.BindException happened when I tried to new MulticastSocket
(223). It should be because the port 223 is lower than 1024.  I tried
with a normal Java application (not Android), the socket can be
created successfully.  So, this access control should only be from
Android platform.

 Is there any way to use the socket port lower than 1024 in Android?
My application has to use this port to receive data from other
official/commercial tool which I can not change. I've added INTERNET
permission and I can create the socket successfully if I change it to
other port bigger than 1023.
--~--~---------~--~----~------------~-------~--~----~



java.net.BindException: Permissions do not allow action on socket

by Jean-Baptiste Queru » Sat, 14 Mar 2009 15:06:39 GMT


 We normally prefer to keep this groups for discussions about changes
in Android that affect application writers. Android-developers might
have been a more appropriate group for your question, though this is
the right place to discuss how to improve the situation.

The short answer is: yes, Android applications can't access ports
lower than 1024. That's a bit of an unfortunate situation. I don't
believe that there's been any change in that area between the original
release and the latest source code.

I believe that one of the open questions is to decide whether access
to low ports should be granted under the regular internet permission,
whether a separate permission should cover all the low ports, or
whether the low ports should be individually covered by separate
permissions (in which case the list of such ports and the way they're
grouped would have to be decided).

JBQ

On Sat, Mar 14, 2009 at 7:56 AM, sharon....@gmail.com





-- 
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


java.net.BindException: Permissions do not allow action on socket

by sharon....@gmail.com » Sat, 14 Mar 2009 15:32:46 GMT


 Is there any workaround I can do to use port 223 at the moment?  Will
this exception happen if I run my application as root?  Is it possible
runing my application ( myapp.apk) as root ? Thanks.




--~--~---------~--~----~------------~-------~--~----~



java.net.BindException: Permissions do not allow action on socket

by Jean-Baptiste Queru » Sat, 14 Mar 2009 15:47:58 GMT


 You'd have to run as root, but that's not possible. Very little of the
system runs as root (in fact even the system server itself, which is
the core of the android runtime, doesn't run as root).

JBQ

On Sat, Mar 14, 2009 at 8:32 AM, sharon....@gmail.com







-- 
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

--~--~---------~--~----~------------~-------~--~----~



java.net.BindException: Permissions do not allow action on socket

by sharon....@gmail.com » Sat, 14 Mar 2009 16:29:27 GMT


  got your point.  I will try other way to get my result.

I hope your raised open question can be addressed in this forum and it
can be closed soon to provide a convenient way for developer for some
specific purpose.

On Mar 14, 11:47pm, Jean-Baptiste Queru <j...@android.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Quick Contacts popup

I can see a new Quick Contacts popup in Android 2.0. How can I use it
in my application? Can't find any samples.

Thanks!

--~--~---------~--~----~------------~-------~--~----~

2. Manage the Wifi connection from an applicacion

Hello,

 I have some troubles connecting to a wireless network. I enable Wifi,
start the scan, and when it is ready I search for the network I am
finding. When I have found it, I create a configuration with every
parameter and it goes properly but when I try to enable it (disabling
the others), it fails.

Maybe I have forgeting anything? Any example I could follow?

Thanks

-- 

3. Wifi does not automatically connect after boot

4. How to get all the log from phone reboot to IDLE

5. Problem download source code in linux (ubuntu 8.04)

6. AlertDialog setSingleChoiceItems

7. Possible to rescan sd-card with Media Scanner?