Skip to content

A simple implementation of a server-client architecture using Java sockets. The server listens for connections and handles communication with the client by reading and sending messages.

Notifications You must be signed in to change notification settings

SubhojitBh/java-socket-server-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Java Socket Server-Client

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.

Features

  • 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.

Getting Started

Prerequisites

  • Java Development Kit (JDK) installed
  • Basic understanding of Java I/O and networking

Running the Server

  1. Compile the MyServer class:

    javac MyServer.java
  2. Run the MyServer class:

    java MyServer

Running the Client

  1. Compile the MyClient class:

    javac MyClient.java
  2. Run the MyClient class:

    java MyClient

About

A simple implementation of a server-client architecture using Java sockets. The server listens for connections and handles communication with the client by reading and sending messages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages