12

Has anybody tried creating RawSocket in Android and have succeeded ?

Ravi
  • 34,851
  • 21
  • 122
  • 183

3 Answers3

10

So far as I'm aware access to raw sockets is not availables in any pure Java library.

In part this is because on most O/S access to raw sockets is a privileged operation, only available to processes running as root / administrator.

The Socket and DatagramSocket classes available in the java.net package are implicitly IP sockets (for TCP, and UDP, respectively).

See for more detail at Apple Lists - Java raw sockets.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
Alnitak
  • 334,560
  • 70
  • 407
  • 495
3

I havent actually created any raw sockets in Android but the java.net and javax.net packages shold do what you need,

java.net package overview

javax.net package overview

Declan Shanaghy
  • 2,314
  • 2
  • 18
  • 19
0

Raw sockets are not supported in any Java or Android libraries

Use 3rd party libraries: RockSaw JSocket

josedlujan
  • 5,357
  • 2
  • 27
  • 49