These techniques are required only for those who need or want to build their own server from the ground up.
You need to write a socket-based server.
Create a ServerSocket for the given port number.
You wish to find out about the computer’s networking arrangements.
Use the NetworkInterface
class.
You need to write a string or binary data to the client.
Use the InputStream
and OutputStream
from the socket.
You need to return an object across a network connection.
Create the object you need, and write it using an ObjectOutputStream
created on top of the socket’s output stream.
You want to protect your network traffic from malicious modification while the data is in transit.
Use the Java Secure Socket Extension, JSSE, to encrypt your traffic.
You MUST have set up a server certificate or you will get
javax.net.ssl.SSLHandshakeException: no cipher suites in common
You want to implement a RESTful server by using the provided Java EE/Jakarta EE APIs.
Use JAX-RS annotations on a class that provides a service; install it in an enterprise application server.