Android 上的原始套接字 [英] Raw Sockets on Android

查看:31
本文介绍了Android 上的原始套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个在 Android 上运行并使用原始套接字的应用程序.我看到 java.net.* 或 android.net.* 库中没有任何原始套接字支持.Android 上可以使用原始套接字吗?

I want to create an application that runs on Android and uses Raw Sockets. I see there isn't any raw socket support in the java.net.* or the android.net.* libraries. Are raw sockets possible on Android?

推荐答案

正确的,任何 Java 或 Android 库都不支持原始套接字,部分原因是(我引用了 此处):

Correct, raw sockets are not supported in any Java or Android libraries, in part because (I quote from here):

相信这样的包会降低当前的 Java安全模型,可能很难在非操作系统中实现(OS) 依赖时尚.

it is believed that such a package would degrade the current Java security model and may be difficult to implement in a non-operating system (OS) dependent fashion.

有 3rd 方库,例如 RockSawJSocket,但是这些需要编译 C 或 C++,所以你不走运.

There are 3rd party libraries like RockSaw or JSocket, however these require compiling C or C++, so you are out of luck there.

另外,我相信您需要 root 访问权限才能使用原始套接字.

Also, I believe you need root access to use raw sockets.

所以,综上所述,我想说从技术上讲这是可能的,但目前不切实际.

So, with all that, I would say technically it's possible, but not practical at this time.

这篇关于Android 上的原始套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆