TCP & UDP Network Applications
Developed two Python socket-based networking applications: a TCP client-server calculator supporting eight mathematical operations and a UDP file-sharing system featuring packet sequencing, chunk-based transmission, and file reconstruction.

Problem
Networked applications require different communication mechanisms depending on their reliability, latency, and data-transfer requirements. TCP provides ordered, reliable byte-stream communication, while UDP transmits independent datagrams without guaranteeing delivery or ordering.
The project explored both approaches by developing a remote calculator using TCP and a simplified file-sharing application using UDP. The main technical challenges involved implementing socket-based request handling, dividing files into network packets, and reconstructing received data in the correct order.
Approach
Implemented a TCP client-server calculator using Python's socket library. The client establishes a TCP connection, sends an encoded mathematical request, and receives the server's response. The server parses incoming requests, executes the requested operation, measures computation time, and returns the result.
Developed a UDP file-sharing application supporting server and receiver modes through command-line arguments. The receiver requests a file by name, and the server reads the file in fixed-size chunks and transmits them directly to the requesting socket address.
Used a 1,024-byte datagram buffer, reserving four bytes for a packet sequence number and up to 1,020 bytes for file content. On the receiving side, implemented dictionary-based packet buffering and sequence-ordered file reconstruction, including checks for missing sequence numbers.
Added basic input validation, file existence checks, exception handling, and automatic socket cleanup.
Outcome
Implemented two Python socket-based networking applications demonstrating TCP request-response communication and UDP file transfer.
The TCP calculator supports eight mathematical operations and returns computation time alongside each result.
The UDP application implements numbered packet transmission and sequence-ordered file reconstruction, allowing text files to be divided into smaller chunks for transfer and reassembled by the receiving program.
The repository includes separate client and server scripts, command-line execution modes, and experimental UDP client-server implementations. The UDP implementation is a local proof of concept; network-wide peer discovery, retransmission, and reliable delivery are not implemented.
Highlights
- Developed TCP and UDP networking applications using Python sockets
- Implemented a TCP calculator supporting eight mathematical operations
- Built a UDP file-transfer system with 1,024-byte datagrams
- Implemented four-byte packet sequence identifiers
- Developed sequence-based buffering and file reconstruction
- Added computation-time measurement to TCP responses
- Implemented command-line server and receiver modes
Notes
Developed two Python networking applications to explore TCP and UDP communication, socket programming, and client-server architecture.
The TCP Calculator implements a request-response system in which clients send mathematical expressions to a server for execution. The server supports eight operations, including addition, subtraction, multiplication, division, and trigonometric functions. It measures computation time and returns both the result and execution duration to the client.
The UDP File Sharing application implements a simplified file distribution system using UDP datagrams. Clients request files by name, while a server locates the requested file and transmits it in numbered packets. Each datagram contains a four-byte sequence identifier followed by a chunk of file data.
Implemented packet buffering and sequence-based reconstruction on the receiving side to assemble incoming chunks in the correct order and detect missing packets during reconstruction.
The project demonstrates practical knowledge of network protocols, socket communication, binary file handling, packet segmentation, client-server design, and transport-layer programming.