Raw socket in java

Nikhil picture Nikhil · Feb 14, 2013 · Viewed 17.7k times · Source

I am pretty new to java socket programming. I had already gone thorugh that java only deals with Internet Domain Sockets and it will support UDP and TCP and Raw IP Protocols. I want to know that is java support Raw Sockets without using any third party applications? If it is possible can anyone help me with a small example? Any small advice will be very greatful!

Answer

Audrius Meskauskas picture Audrius Meskauskas · Feb 14, 2013

The only really available support for raw sockets in Java standard library seems the InetAddress.isReachable() that may do ICMP ping if permitted. This is really not much and probably even not really a raw socket, just one more protocol.

For other types of raw communication I would recommend to use Berkley sockets under Linux (root rights required) through some JNI - based wrapper.