Socket communication in Java enables communication between two endpoints over a network. There are two main types of sockets: TCP sockets and UDP sockets. Let's explain both types with examples: TCP Socket Communication: 1. **Server Side**: - The server creates a `ServerSocket` object to listen for incoming connections on a specific port. - When a client connects, the server accepts the connection and creates a `Socket` object to communicate with the client. - The server reads from and writes to the socket's input and output streams to communicate with the client. import java.io.*; import java.net.*; public class TCPServer { public static void main(String[] args) throws IOException { ServerSocket serverSocket = new ServerSocket(12345); System.out.println("Server started. Waiting for client..."); Socket clientSocket = serverSocket.accept(); ...
Experiment No: 1 Aim: Study of Java run time environment (JRE) Theory: Java is a programming language and a platform. Platform Any hardware or software environment in which a program runs, known as a platform. Since Java has its own Runtime Environment (JRE) and API, it is called platform. The history of Java is a fascinating journey that began in the early 1990s and continues to shape the modern software development landscape. Here's an overview of the key milestones and events in the history of Java: Origins (Early 1990s): Java's story begins with a team of engineers at Sun Microsystems, led by James Gosling, Mike Sheridan, and Patrick Naughton. Their goal was to create a programming language that could be used to develop software for consumer electronic devices, such as set-top boxes and interactive television. Green Project (1991): The project, initially known as the "Green Project," aimed to develop a language that could addr...