Skip to content

RedesdeOrdenadores/tcpmt-2022-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Possible Implementation of the Multi-Threaded Remote TCP-Based Calculator Exercise for the Computer Networks Subject

Build Status

Overview

This is a Rust language implementation for a programming task of the Computer Networks subject of the Bachelor Degree in Telecommunication Technologies Engineering of the Universidade de Vigo.

As the exercise involves a very basic socket communication scenario, the code tries to provide a minimally satisfactory solution without consideration to performance or security whatsoever.

About the Code

The client and server programs are contained in the files tcpmtcli.rs and tcpmtser.rs. They make use of a little library for parsing the arithmetic operations both from the user and from/to the network.

The file operations.rs defines the allowed set of arithmetic operations, the functions to calculate them and all the conversions needed: from TLV fields and to from strings for exchanging data with the user.

Finally, a set of utilities for managing TLVs are provided in the file tlv.rs.

The encoding and decoding procedures for answers* have been implemented in answers.rs.

All the encoding and decoding methods have been performed manually, instead of using a crate like serde as this was something that students are expected to learn how to do it in this exercise. Obviously, if this were not an exercise, it would have been more adequate to not try to reinvent the wheel.

Dependencies

Even if the spirit was to do as much of the code ourselves, we have used some dependencies for the tasks not directly related with the communication problem. The list is as follows:

  • anyhow and thiserror: For easy error management and definition, respectively.
  • clap: To parse command line arguments.
  • regex: To parse the operations as entered by the user
  • socket2: We needed to use this low-level socket library in the server to make the Windows version of the program behave like the Linux one. We use a IPV6 socket on the server to accept both IPv4 and IPv6 connections. Under Linux this works by default, but in windows this has to be enabled manually. Two alternative solutions would have been:
    • Ignoring the issue and accepting only IPv6 connections under Windows,
    • use simultaneous sockets in the server, but this complicates the code so much.
  • num_enum: Avoid manual conversions between u8 and TvlType.

Legal:

Copyright ⓒ 2023 Universidade de Vigo.
Author: Miguel Rodríguez Pérez miguel@det.uvigo.gal.
This software is licensed under the GNU General Public License, version 3 (GPL-3.0) or later. For information see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages