Skip to content

Getting Started: CLI (Linux)

Wonsup Yoon edited this page Mar 21, 2024 · 12 revisions

Prerequisites

Install build tools

  • Compiler requirements
  • for Debian/Ubuntu: (sudo) apt install make gcc g++ gdb
  • for CentOS/Fedora: (sudo) yum install make gcc gcc-c++ gdb

Install CMake

KENS requires CMake 3.11 or higher.

  • for recent Linux distros (Debian 10, Ubuntu 20.04, CentOS 8, Fedora 26, or later)
    • for Debian/Ubuntu: (sudo) apt install cmake
    • for CentOS/Fedora: (sudo) yum install cmake
  • for old Linux distros

Build

  1. Download and extract latest version.
  2. Open terminal and go to the extracted directory
  3. Prepare build files
$ cmake -B build .
  1. Move to build directory
$ cd build
  1. Build
$ make -j$(nproc)

Test

Socket Programming (PA#1)

Run following binary.

$ ./app/echo/echo

Using random seed.

$ RANDOM_SEED=1234 ./app/echo/echo

You can use non-kens binary to run the echo application via following.

$ ./app/echo/echo-non-kens

TCP

Run following binaries to test your TCP implementation (part1 and part2 for PA#2).

Open, bind, handshake, and close (PA#2)

$ ./app/kens/test-kens-open
$ ./app/kens/test-kens-bind
$ ./app/kens/test-kens-handshake
$ ./app/kens/test-kens-close

Using random seed.

$ RANDOM_SEED=1234 ./app/kens/test-kens-open
$ RANDOM_SEED=1234 ./app/kens/test-kens-bind
$ RANDOM_SEED=1234 ./app/kens/test-kens-handshake
$ RANDOM_SEED=1234 ./app/kens/test-kens-close

Transfer and unreliable tests (PA#3)

$ ./app/kens/test-kens-transfer
$ ./app/kens/test-kens-open-unreliable
$ ./app/kens/test-kens-bind-unreliable
$ ./app/kens/test-kens-handshake-unreliable
$ ./app/kens/test-kens-close-unreliable
$ ./app/kens/test-kens-transfer-unreliable

Using random seed.

$ RANDOM_SEED=1234 ./app/kens/test-kens-transfer
$ RANDOM_SEED=1234 ./app/kens/test-kens-open-unreliable
$ RANDOM_SEED=1234 ./app/kens/test-kens-bind-unreliable
$ RANDOM_SEED=1234 ./app/kens/test-kens-handshake-unreliable
$ RANDOM_SEED=1234 ./app/kens/test-kens-close-unreliable
$ RANDOM_SEED=1234 ./app/kens/test-kens-transfer-unreliable

Running prebuilt solutions

You can run KENS with prebuilt solutions.

  • Running prebuilt solutions
$ ./app/kens/test-kens-open-run-solution
$ ./app/kens/test-kens-bind-run-solution
$ ./app/kens/test-kens-handshake-run-solution
$ ./app/kens/test-kens-close-run-solution
$ ./app/kens/test-kens-transfer-run-solution
$ ./app/kens/test-kens-open-unreliable-run-solution
$ ./app/kens/test-kens-bind-unreliable-run-solution
$ ./app/kens/test-kens-handshake-unreliable-run-solution
$ ./app/kens/test-kens-close-unreliable-run-solution
$ ./app/kens/test-kens-transfer-unreliable-run-solution

Routing (PA#4)

Use routing-all to test routing assignment.

$ ./app/routing/routing-all

Troubleshooting

Specifying compiler

Some environments need to specify compiler to build KENS. You can set compilers like below.

Using GCC

$ cmake -B build . -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++

Using Clang

$ cmake -B build . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++

Using Ninja Build

$ cmake -B build . -G "Ninja"
Clone this wiki locally