Author: Dhruv Trivedi
Course: CS 436 - Networks and Distributed Computer Systems
Instructor: Noura Limam
This project provides a hands-on introduction to TCP and UDP socket programming within a client-server paradigm. The primary functionality is string reversal: a client sends a string to the server over a network, and the server returns its reverse.
The communication follows a two-stage process:
- 🛠️ Negotiation Stage: Through the server's fixed negotiation port (
<n_port>
), the client and server determine a random port (<r_port>
) for subsequent data transfer. - ✅ Transaction Stage: Actual data transfer happens where the client connects using the negotiated
<r_port>
.
- Navigate to the project's
source
directory on your server machine:cd ./source
- Start the server by entering:
Where:
python server.py <n_port> <req_code>
- 🔹
<n_port>
: The TCP negotiation port number. - 🔹
<req_code>
: The request code against which the client's requests will be verified.
- 🔹
- Navigate to the project's
source
directory on your client machine:cd ./source
- Start the client by entering:
Where:
python client.py <server_address> <n_port> <req_code> <msg>
- 🔹
<server_address>
: The server's address (e.g., "ubuntu2004-008.student.cs.uwaterloo.ca" or "ubuntu2004-008"). - 🔹
<n_port>
: The TCP negotiation port for server communication. - 🔹
<req_code>
: The client's request code for negotiation. - 🔹
<msg>
: The string that you'd like the server to reverse.
- 🔹
💡 Note: If the request codes on both the client and server match, the client sends the message to the server and receives its reverse.
The program has been successfully tested on the following machines:
-
🌐 Machine Details:
- Hostname: ubuntu2004-008.student.cs.uwaterloo.ca
- CPU Type: Intel(R) Xeon(R) CPU E5-2697A v4 @ 2.60GHz
- Make: Dell Inc.
-
🌐 Machine Details:
- Hostname: ubuntu2004-010.student.cs.uwaterloo.ca
- CPU Type: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
- Make: Supermicro