GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - AFNeves/PenguinRS232: A C implementation of a data transmission protocol over an RS-232 serial connection using Stop-and-Wait flow control and error handling, developed for the Computer Networks course at FEUP.

BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
docs
docs
 
 
include
include
 
 
src
src
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
main.c
main.c
 
 

Repository files navigation

PenguinRS232

A C implementation of a data transmission protocol over a serial connection, using a simplified link-layer and application-layer architecture. The project was developed for the Computer Networks course at FEUP.

๐Ÿ“ Project Structure

The project is structured as follows:

.
โ”œโ”€โ”€ bin/                # Compiled binaries (created after building)
โ”œโ”€โ”€ include/            # Header files for link and application layers
โ”‚   โ”œโ”€โ”€ application_layer.h
โ”‚   โ””โ”€โ”€ link_layer.h
โ”œโ”€โ”€ src/                # Source code for protocol implementation
โ”‚   โ”œโ”€โ”€ application_layer.c
โ”‚   โ””โ”€โ”€ link_layer.c
โ”œโ”€โ”€ assets/             # Test files used for transmission
โ”‚   โ””โ”€โ”€ penguin.gif     # Default file to send
โ”œโ”€โ”€ docs/               # Project documentation
โ”‚   โ””โ”€โ”€ Report_3LEIC12_G1.pdf
โ”œโ”€โ”€ main.c              # Entry point for the application
โ”œโ”€โ”€ Makefile            # Build and run instructions
โ”œโ”€โ”€ LICENSE             # MIT License
โ””โ”€โ”€ README.md           # Project overview and usage guide

๐Ÿงช Running the Project

This project is designed to operate on real Linux systems connected via an RS-232 serial cable. However, for ease of testing and demonstration, these instructions use socat to create virtual serial ports on a single machine. You can follow the steps below to set up and test the protocol using virtual ports. If you wish to use actual hardware, simply update the serial port paths in the configuration (e.g., /dev/ttyS0, /dev/ttyS1) to match your physical devices.

0. Optional Configuration

Before running the project, you may wish to customize certain settings to match your environment or testing needs. This includes changing serial port paths, selecting a different test file, or adjusting transmission parameters.

Edit Serial Port Paths and Test Files

Open the Makefile and update these variables as needed:

# Serial port device paths
TX_SERIAL_PORT = /dev/ttyS10   # Transmitter port
RX_SERIAL_PORT = /dev/ttyS11   # Receiver port

# Test file names
TX_FILE = penguin.gif          # File to send
RX_FILE = penguin-received.gif # File to receive

Adjust Transmission Parameters

To experiment with different protocol settings, edit the following constants in main.c:

#define BAUDRATE 9600  // Serial communication speed
#define N_TRIES 4      // Number of retransmission attempts
#define TIMEOUT 3      // Timeout (seconds) for retransmission

Make sure to rebuild the project after making changes to the Makefile or source files.

1. Compilation

Build the project using the provided Makefile:

$ make

This compiles all source files in src/ and places the final executable in bin/main.

2. Create Virtual Serial Ports

Run this command in a separate terminal window to create a pair of connected serial ports:

$ sudo socat -d -d PTY,link=/dev/ttyS10,mode=777 PTY,link=/dev/ttyS11,mode=777
  • /dev/ttyS10 โ†’ transmitter port
  • /dev/ttyS11 โ†’ receiver port

โš ๏ธ Keep this terminal open while testing!

The virtual serial ports will remain active only as long as this terminal is running. Closing it will disconnect the ports and interrupt communication.

3. Start the Receiver

In a new terminal, start the receiver process:

$ make run_rx

This listens on /dev/ttyS11 and saves the received file as assets/penguin-received.gif.

4. Start the Transmitter

In another terminal, start the transmitter:

$ make run_tx

This sends assets/penguin.gif through /dev/ttyS10.

4. Verify File Integrity

After the transfer completes, compare the original and received files:

$ make check_files

If everything worked correctly, you should see:

Files assets/penguin.gif and assets/penguin-received.gif are identical

5. Clean Up

Remove compiled files and received test data:

$ make clean

๐Ÿ“„ Documentation

The full project report detailing the protocol design and implementation can be found in docs/Report_3LEIC12_G1.pdf.

Note: The report is written in Portuguese.

๐Ÿ‘ฅ Authors

  • Afonso Neves ([email protected])
  • Joรฃo Miranda ([email protected])

๐Ÿ“Ž License

This project is licensed under the terms of the MIT License.

About

A C implementation of a data transmission protocol over an RS-232 serial connection using Stop-and-Wait flow control and error handling, developed for the Computer Networks course at FEUP.

sigarra.up.pt/feup/en/UCURR_GERAL.FICHA_UC_VIEW?pv_ocorrencia_id=520330

Topics

application-layerarqccomputer-networksfile-transferlink-layerprotocol-implementationrs232serial-communicationstop-and-wait

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402775 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.