This application is a server-client system that checks for palindromes. The server handles two types of checks:
- Simple Palindrome Check: Determines if a string is a palindrome (ignoring case, spaces, and special characters).
- Complex Palindrome Check: Determines if a string can be rearranged into a palindrome and calculates the minimum number of swaps required.
You may come across some codes snippets that aren't related to the problem, they were implemented for testing automation but doesn't affect the actual functionality or manual testing.
- Server:
- TCP socket-based communication.
- Multithreaded to handle multiple clients.
- Logs client requests/responses to
server_log.txt
.
- Client:
- Menu-driven interface for simple/complex checks.
- Timeout handling with 3 retries.
-
Prerequisites:
- Python 3.6 or later.
- No external libraries required (uses built-in modules:
socket
,threading
,logging
).
-
Download Code:
server.py
: Server code.client.py
: Client code.
-
Start the Server:
python server.py
- The server starts on
localhost:12345
and logs activity toserver_log.txt
.
- The server starts on
-
Run the Client:
python client.py
- Follow the menu to select checks. Example:
Menu: 1. Simple Palindrome Check 2. Complex Palindrome Check 3. Exit Enter choice (1/2/3): 2 Enter a string: ivicc
-
WireShark tracking
- To check the optional implementation
- Open WireShark
- Filter
tcp.port == 12345
- Follow step 1 and 2
Simple Check
Input: "A man, a plan, a canal, Panama"
Output: Is palindrome: True
Complex Check
Input: "ivicc"
Output: Can form palindrome: True, Complexity score: 2
Input: "aabb"
Output: Can form palindrome: True, Complexity score: 1
Log File: server_log.txt
- Logged Data:
- Client IP address.
- Request type (simple/complex).
- Input string.
- Result (true/false) and complexity score.
Example Log Entry:
2023-10-10 12:00:00 - Connection from ('127.0.0.1', 54321)
2023-10-10 12:00:05 - Received request: complex|ivicc
2023-10-10 12:00:05 - Sent response: Can form palindrome: True, Complexity score: 2
Basic Encryption: Implemented basic encryption for data transmitted between the server and client using caesar cipher.