简体   繁体   English

在android中打开服务器套接字:权限被拒绝?

[英]Open server socket in android : permission denied?

I'm trying to create server socket on port 554 (rtsp) in Android and i'm getting BindException with 'denied' message: 我正在尝试在Android的端口554(rtsp)上创建服务器套接字,并且我收到带有'denied'消息的BindException

        public RequestListener() throws IOException {
            try {
                mRtspServerSocket = new ServerSocket(mPort);
                start();
            } catch (BindException e) {
                Log.e(TAG, "Port bind exception");
                throw e;
            }
        }

Are standard ports (or < 1024) unavailable for binding? 标准端口(或<1024)是否不可用于绑定? Do i have to have root permission on the device for that? 为此,我是否需要在设备上具有root权限?

PS. PS。 I have <uses-permission android:name="android.permission.INTERNET" /> in AndroidManifest.xml 我在AndroidManifest.xml中有<uses-permission android:name="android.permission.INTERNET" />

You can't bind to ports <1024. 您无法绑定到<1024的端口。

Either root your phone, modify the firmware, or don't bind to ports lower than 1024. That's a Linux thing more than an Android thing. root您的手机,修改固件,或者不绑定低于1024的端口。这是Linux而不是Android。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM