Skip to content
This repository was archived by the owner on Sep 15, 2026. It is now read-only.

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CSNETWK Coding Assignments

Laboratory 3 — Simple TCP Client/Server (Sockets)

  • Description: This lab demonstrates basic TCP sockets in Java. The server listens on port 5001 and replies with a fixed server number. The client connects to the server, sends an integer (1–100) and the server replies with its number; both print the sum of the two numbers.

  • Files: Server.java, Client.java

  • Requirements: Java JDK (8+)

  • How to compile:

javac Server.java Client.java
  • How to run (open two terminals):
# Terminal 1: start the server
java Server

# Terminal 2: run the client and follow the prompt
java Client
  • Behavior / Notes:
    • Server listens on port 5001 and uses SERVER_NUMBER = 50 in its reply.
    • Client connects to 127.0.0.1:5001, prompts for an integer (1–100), sends message in the format ClientName, number = <n>, and prints the server reply and computed sum.
    • If the client inputs a number outside 1–100, it will exit with an error. If the server receives an invalid number, it will log and terminate per the current implementation.

About

A simple Java TCP client-server application demonstrating socket communication and message exchange.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages