CS144:实现一个简单的TCP/IP协议

课程官网:CS 144: Introduction to Computer Networking

这们课的实验是利用C++实现一个简易的TCP/IP协议栈。

官方给出了五种搭建实验环境的方式,这里我选择了第三种

参考我之前写的一篇Windows下搭建Linux开发环境的文章:基于VSCode+Clangd+lldb搭建Linux C++环境_cmake options: status bar visibility-CSDN博客

安装完WSL和Docker之后在CS144项目目录下配置.devcontainer的devcontainer.json和Dockerfile

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
    "name": "CS144",
    "build": {
        "dockerfile": "Dockerfile"
    },
    // Features to add to the dev container. More info: https://containers.dev/features.
    // "features": {},
    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],
    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "gcc -v",
    // Configure tool-specific properties.
    // "customizations": {},
    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"
}
# 使用最新的 Ubuntu 镜像作为基础镜像
FROM ubuntu:23.10

# 更新软件包列表并安装所需软件包,之后清理缓存
RUN apt-get update && apt-get install -y git cmake gdb build-essential clang \
    clang-tidy clang-format gcc-doc pkg-config glibc-doc tcpdump tshark \
    && rm -rf /var/lib/apt/lists/*

 然后Ctrl+Shift+P执行Dev Containers: Reopen in Container,就会创建容器,并用VSCode在容器中打开当前项目。

 可以看到我这里已经成功进入容器中并且安装了实验要求的g++版本

至于如何调试,还是请参考

基于VSCode+Clangd+lldb搭建Linux C++环境_cmake options: status bar visibility-CSDN博客

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值