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!
close() call shuts down the socket associated with the socket descriptor socket, and frees resources allocated to the socket. If socket refers to an open TCP connection, the connection is closed. If a stream socket is closed when there is input data queued, the TCP connection is reset rather than being cleanly closed.
isClosed() tells you whether you have closed this socket. Until you have, it returns false.
The finalize() method is called by the Java virtual machine ( JVM ) before the program exits to give the program a chance to clean up and release resources. Multi-threaded programs should close all Files and Sockets they use before exiting so they do not face resource starvation.
A raw socket is a type of socket that allows access to the underlying transport provider. This topic focuses only on raw sockets and the IPv4 and IPv6 protocols. This is because most other protocols with the exception of ATM do not support raw sockets.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With