Is there any way to use the socket port lower than 1024 (eg. 223) in Android platform

by sharon....@gmail.com » Sun, 15 Mar 2009 13:13:54 GMT


Sponsored Links
 Is there any way to use the socket port lower than 1024 with class
MulticastSocket? My application has to use this port to receive data
from other official tool which I can not change.  But
java.net.BindException happend when I new a MulticastSocket instance.
I've added INTERNET permission and I can create the socket if I change
it to other port bigger than 1023.

Source code : sock = New MulticastSocket(223)

Log:
I/System.out(  279): SocketException happend
W/System.err(  279): java.net.BindException: Permissions do not allow
action on socket
W/System.err(  279):    at
org.apache.harmony.luni.platform.OSNetworkSystem.socketBindImpl2
(Native Method)
W/System.err(  279):    at
org.apache.harmony.luni.platform.OSNetworkSystem.bind2
(OSNetworkSystem.java:145)
W/System.err(  279):    at
org.apache.harmony.luni.net.PlainDatagramSocketImpl.bind
(PlainDatagramSocketImpl.java:119)
W/System.err(  279):    at java.net.MulticastSocket.createSocket
(MulticastSocket.java:564)
W/System.err(  279):    at java.net.DatagramSocket.<init>
(DatagramSocket.java:82)
W/System.err(  279):    at java.net.MulticastSocket.<init>
(MulticastSocket.java:60)
W/System.err(  279):    at com.android.sockport.SocketPort.onCreate
(SocketPort.java:28)
W/System.err(  279):    at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
W/System.err(  279):    at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2103)
W/System.err(  279):    at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
W/System.err(  279):    at android.app.ActivityThread.access$1800
(ActivityThread.java:112)
W/System.err(  279):    at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1580)
W/System.err(  279):    at android.os.Handler.dispatchMessage
(Handler.java:88)
W/System.err(  279):    at android.os.Looper.loop(Looper.java:123)
W/System.err(  279):    at android.app.ActivityThread.main
(ActivityThread.java:3742)
W/System.err(  279):    at java.lang.reflect.Method.invokeNative
(Native Method)
W/System.err(  279):    at java.lang.reflect.Method.invoke(Method.java:
515)
W/System.err(  279):    at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:739)
W/System.err(  279):    at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:497)
W/System.err(  279):    at dalvik.system.NativeStart.main(Native
Method)

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



Other Threads

1. why in emulator, "/dev/eac" is connected with the audio?




the /dev/eac device node is supported by the emulator-specific kernel code
located here:

http://android.git.kernel.org/?p=kernel/common.git;a=blob;f=arch/arm/mach-goldfish/audio.c;h=c7973e70a114a08dcc57af954223acdfaec3b49e;hb=android-goldfish-2.6.29

it is used to send/receive sound samples by reading/writing various i/o
memory registers.

this is emulated/supported by the emulator source file "goldfish_audio.c",
see:
http://android.git.kernel.org/?p=platform/external/qemu.git;a=blob;f=hw/goldfish_audio.c;h=d0a44b564c29364a884ffd091088a25933ea2da4;hb=2b8ea29e2bd12f876a4d06647e6077bf72de567e

which itselfs uses the QEMU audio sound-system (located in
external/qemu/audio) which is actually rather complex, but described by the
light documentation I wrote for it here:
http://android.git.kernel.org/?p=platform/external/qemu.git;a=blob;f=docs/AUDIO.TXT;h=71ec288ef950aee341e3469f3a5520fd83b4a8a2;hb=2b8ea29e2bd12f876a4d06647e6077bf72de567e

external/qemu/audio contains several "audio backends" that communicate with
the host sound system, for example:

coreaudio.c  for OS X
windaudio.c for Win32
esdaudio.c for EsounD on Linux
alsaaudio.c for ALSA on Linux
etc...

so what happens when generating sound output is:

AudioFlinger -> /dev/eac -> kernel (mach-goldfish/audio.c) -> emulator
(external/qemu/goldfish_audio.c -> QEMU audio sub-system -> system-specific
audio  backend) -> system sound API

Hope this helps







--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Can I put something into the ScrollView of WebView?

Hi,

   I show articles in WebView and would like to add some additional  
information, e.g. publishing date, author etc., into the same  
ScrollView above the original content. So that it usually doesn't take  
up space, but the user can just scroll back when the information is  
needed.

   Did any of you do something like that in a sane way?

   I thought I can put my stuff into the same ScrollView that WebView  
uses, but when looking at it with hierarchyviewer I can't see any  
children, it's probably native.

Cheers,
Mariano

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

3. Activity execute onDestroy() and onCreate() method when push on keyboard.

4. Activity execute onDestroy() and onCreate() method when push on keyboard.

5. Duplicated text when using .append in widgets

6. Documentation does not specify when an API was added

7. Random crashes on MapActivity when rendering tile