Giter Site home page Giter Site logo

udp_tcp_relay's Introduction

UDP to TCP Relay

This program is a UDP to TCP relay that accepts data blocks via UDP and sends them via TCP to a server. It is designed to handle specific requirements and provides reliable data transfer between UDP and TCP protocols.

Features

  • Accepts data blocks via UDP and sends them via TCP to a server
  • Each UDP packet can contain only one data block ranging from 16 to 128 bytes in length
  • Adds a prefix of four characters (specified as a parameter) to each data block before sending it to the server
  • Maintains a permanent TCP connection with the server and automatically re-establishes the connection in case of failure
  • Discards UDP data if it arrives when the TCP connection is not established
  • Ignores any data received from the TCP server
  • Logs important events, such as establishing or breaking TCP connections, data transmission or reception errors, etc.

Requirements

  • Linux operating system
  • GCC compiler
  • Make build system

Building the Program

To build the program, navigate to the project directory and run the following command:

make

This will compile the source files and generate the executable udp_tcp_relay.

Running the Program

To run the program, use the following command:

./udp_tcp_relay <udp_ip:port> <tcp_ip:port> <log_file> <prefix>
  • <udp_ip:port>: The IP address and port number for receiving UDP data blocks.
  • <tcp_ip:port>: The IP address and port number of the TCP server to send modified data blocks to.
  • <log_file>: The path to the log file where important events will be logged.
  • <prefix>: The four characters to be added as a prefix to the transmitted data blocks.

Test Server Programs

The repository also includes test server programs located in the test_servers folder. These programs can be used to simulate the UDP client and TCP server for testing purposes.

To build the program

To run the test servers, open a new terminal window, navigate to the test_servers folder, and run the following command:

make

This will build TCP server and UDP server

make run

This will start the TCP server and run the UDP client simultaneously.

To stop the test servers, use the following command:

make stop

This will terminate the running TCP server process.

Folder Structure

  • include/: Contains the header files
  • src/: Contains the source code files
  • obj/: Contains the object files generated during compilation
  • test_servers/: Contains the test server programs (UDP client and TCP server)

udp_tcp_relay's People

Contributors

54m47 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.