This repository contains a simple implementation of a server-client architecture using Java sockets. The server listens for incoming connections on a specified port and the client connects to the server to exchange messages.
- Server listens on port 4999 for incoming client connections.
- Client connects to the server on localhost.
- Client sends a message to the server.
- Server reads the message and responds back to the client.
- Resources are managed using try-with-resources to ensure proper closure.
- Java Development Kit (JDK) installed
- Basic understanding of Java I/O and networking
-
Compile the
MyServer
class:javac MyServer.java
-
Run the
MyServer
class:java MyServer
-
Compile the
MyClient
class:javac MyClient.java
-
Run the
MyClient
class:java MyClient