Skip to content

Sample of C Code: Simulation of the transport layer of a network stack by implementing a custom Reliable Transport Protocol (RTP) using the Stop-and-Wait protocol

Notifications You must be signed in to change notification settings

avmadhwesh/C-Sample-Building-Networking-Protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 Repository Description Reliable Networking Protocol Implementation

This project simulates the transport layer of a network stack by implementing a custom Reliable Transport Protocol (RTP) using the Stop-and-Wait protocol. The system ensures reliable message delivery over an unreliable network by handling packet segmentation, checksum validation, acknowledgment (ACK/NACK) handling, and message reassembly. The client sends encrypted (ROT13) messages to a server, which decrypts and returns the message after successful transmission.

🛠️ What I worked on src/rtp.c & src/rtp.h

  • Implemented the packetization process to divide large messages into fixed-size packets, marking the last packet appropriately.

  • Developed a custom checksum algorithm to detect packet corruption by swapping character pairs and computing a weighted sum of ASCII values.

  • Built the Stop-and-Wait protocol logic, handling ACK/NACK acknowledgments and retransmissions.

  • Managed multi-threaded communication using thread synchronization (mutexes and condition variables) to ensure thread-safe queue operations.

  • Designed the receive thread to validate packet integrity, request retransmissions if needed, and reassemble complete messages.

  • Handled robust resource management, including memory allocation and deallocation, to prevent memory leaks.

-Ensured clean compilation with no warnings, well-documented code, and adherence to concurrency best practices.

About

Sample of C Code: Simulation of the transport layer of a network stack by implementing a custom Reliable Transport Protocol (RTP) using the Stop-and-Wait protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published