Java socket programming assignment for Distributed Systems.
It implements three network applications demonstrating client-server communication patterns,
multi-threading, and network application development using Java 17.
Simple utility program that converts hostnames to IP addresses using Java's InetAddress class.
Multithreaded server that responds with "pong" to "ping" messages while dropping other messages.
Client-server application where the server converts received messages to uppercase and returns them.
- Language: Java 17.0.14 LTS
- IDE: IntelliJ IDEA
- Operating System: Windows 10 (adaptable to other platforms)
- Libraries: Standard Java libraries (
java.net,java.io) - Character Encoding: UTF-8 for international support
socket-programming/
βββ README.md # Main project documentation
βββ .gitignore # Git ignore patterns
βββ compile-all.bat # Compilation script
βββ run-servers.bat # Server startup script
β
βββ docs/ # Comprehensive documentation
β βββ compilation-guide.md # Compilation and setup instructions
β βββ troubleshooting.md # Common issues and solutions
β βββ examples.md # Usage examples and scenarios
β βββ code-quality-review.md # Code quality assessment
β βββ integration-analysis.md # Cross-task integration analysis
β
βββ task1-hostname-converter/ # Task 1: DNS resolution
β βββ src/
β β βββ HostnameToIP.java # Main application class
β βββ docs/
β βββ requirements.md # Task requirements
β βββ design.md # Design documentation
β βββ UserGuide.md # User manual
β
βββ task2-ping-pong/ # Task 2: Client-server communication
β βββ src/
β β βββ server/
β β β βββ PingPongServer.java # Multi-threaded server
β β βββ client/
β β βββ PingPongClient.java # Interactive client
β βββ docs/
β βββ architecture.md # System architecture
β βββ protocol.md # Communication protocol
β βββ client-usage.md # Client usage guide
β βββ run-configurations.md # IDE configuration
β βββ usage.md # General usage guide
β
βββ task3-uppercase-converter/ # Task 3: Text processing service
β βββ src/
β β βββ server/
β β β βββ UppercaseServer.java # Production-quality server
β β βββ client/
β β βββ UppercaseClient.java # Feature-rich client
β βββ docs/
β βββ design.md # Design documentation
β βββ workflow.md # Processing workflows
β
βββ tests/ # Comprehensive testing
βββ task1/
β βββ TestCases.md # Test cases and results
β βββ TestExecutionLog.md # Execution logs
β βββ PerformanceTest.md # Performance analysis
βββ task2/
β βββ IntegrationTestPlan.md # Integration testing
β βββ TestExecutionLog.md # Test results
β βββ MultiClientTest.md # Multi-client testing
βββ task3/
βββ TestingPlan.md # Comprehensive test plan
βββ TestExecutionLog.md # Detailed test results
βββ PerformanceResults.md # Performance benchmarks
- Java 17.0.14 LTS or higher
- IntelliJ IDEA (recommended)
- Git for version control
- Windows 10 (instructions adaptable for other OS)
git clone https://github.com/NMsby/socket-programming.git
cd socket-programming compile-all.bat run-servers.bat cd task1-hostname-converter
javac src/HostnameToIP.java
java -cp src HostnameToIP # Terminal 1 - Server
cd task2-ping-pong
javac src/server/PingPongServer.java
java -cp src server.PingPongServer
# Terminal 2 - Client
javac src/client/PingPongClient.java
java -cp src client.PingPongClient # Terminal 1 - Server
cd task3-uppercase-converter
javac src/server/UppercaseServer.java
java -cp src server.UppercaseServer
# Terminal 2 - Client
javac src/client/UppercaseClient.java
java -cp src client.UppercaseClientObjective: Learn basic networking and DNS resolution
Features:
- Interactive hostname input and IP address resolution
- Support for IPv4 and IPv6 addresses
- Multiple IP address handling
- Comprehensive error handling
- Address type classification
Key Learning: DNS resolution, InetAddress class, network error handling
Objective: Understand client-server architecture and protocols
Features:
- Multi-threaded TCP server supporting concurrent clients
- Case-insensitive ping detection with exact matching
- Message filtering (only "ping" receives "pong" response)
- Interactive client with automated testing
- Comprehensive connection management
Key Learning: TCP sockets, multi-threading, protocol design, resource management
Objective: Build production-quality network applications
Features:
- UTF-8 encoding for international character support
- Rich interactive client with comprehensive commands
- Detailed logging and monitoring capabilities
- Performance optimization and error recovery
- Configurable message length limits
Key Learning: Character encoding, production patterns, performance optimization
- Unit Testing: Individual component validation
- Integration Testing: Cross-component functionality
- Performance Testing: Response times and throughput
- Load Testing: Concurrent client handling
- Edge Case Testing: Error conditions and recovery
- Task 1: 100% success rate with comprehensive DNS testing
- Task 2: Multi-client support validated up to 50+ concurrent connections
- Task 3: International character support verified with UTF-8 encoding
- Overall: All performance targets exceeded with <10Β ms average response times
| Metric | Task 1 | Task 2 | Task 3 |
|---|---|---|---|
| Response Time | <100ms | <10ms | <10ms |
| Concurrent Clients | N/A | 50+ | 50+ |
| Throughput | N/A | 200+ msg/s | 200+ msg/s |
| Memory Usage | <20MB | <40MB | <40MB |
| Success Rate | 100% | 100% | 100% |
- Open Project: File β Open β Select project directory
- Configure SDK: Project Structure β Project β Set Java 17
- Build Project: Build β Build Project
- Run Configurations: Pre-configured for each task component
- Compilation Scripts:
compile-all.batfor automated building - Server Management:
run-servers.batfor concurrent server startup - Individual Compilation: Task-specific compilation commands
- Assignment Requirements: Overview of project goals and objectives
- Implementation Notes: Detailed implementation notes for each task
- Compilation Guide: Setup and building instructions
- Troubleshooting Guide: Common issues and solutions
- Usage Examples: Comprehensive usage scenarios
Each task includes detailed documentation covering:
- Requirements analysis and design decisions
- Architecture and implementation details
- Usage guides and examples
- Testing procedures and results
- Authentication and authorization
- TLS/SSL encryption support
- Load balancing capabilities
- Database integration
- REST API endpoints
- Web-based management interface
- Additional protocol implementations
- Performance monitoring dashboards
- Container deployment (Docker)
- Microservices architecture
- Message queuing systems
This is an academic project, but suggestions and improvements are welcome!
Nelson Masbayi
- Distributed Systems Assignment
- Java 17 Socket Programming Implementation
This project is licensed under the MIT License - see the LICENSE file for details.