Introduction

This project involves developing a simple network application in C using the socket API to explore the functionalities of UDP and TCP protocols. The goal is to understand how these protocols handle message transmission in a networked environment, with focus on the differences in reliability, message delivery, and connection handling.

In this lab, we explored the fundamental differences between the UDP and TCP protocols using the tsock application in a Linux environment. The objective was to observe how each protocol handles data transmission, reliability, and connection establishment.

Part 1: Comparing UDP and TCP

UDP Transmission:

TCP Transmission:

Part 2: Testing Protocol Behavior Without Open Ports

TCP Connection Refusal:

UDP Message Handling:


Part 3: Capturing and Analyzing Network Traffic

Using tcpdump to Monitor Traffic:

ssh tcpdump@insa-20673

sudo tcpdump 9025

Observations with UDP:


Observations with TCP:


Part 4: Capturing and Analyzing Network Traffic

Captured raw Ethernet frames using: sudo tcpdump -xx 9025


Part 5: Exploring Broadcast Traffic

Captured broadcast messages with: tcpdump -xx broadcast

Conclusion

This project explored the fundamental differences between UDP and TCP protocols, practicing socket creation and machine-to-machine communication management using C. We observed the advantages and disadvantages of each protocol, including UDP’s speed but lack of delivery guarantees, versus TCP’s reliability and error handling. In addition, using tcpdump allowed us to analyze network traffic and better understand transmission mechanisms, such as TCP handshake and Ethernet frame structure. This project provided a solid foundation for understanding the challenges of network communication in distributed environments.