CS144 计算机网络实验lab1环境搭建以及实验过程(测试百分百通过)

该博客介绍了如何使用C++编写一个简单的HTTP客户端,通过TcpSocket连接到指定主机并请求URL路径。同时,还定义了一个ByteStream类,实现了字节流的读写操作,包括双端队列的管理。内容涵盖了TCP连接、HTTP请求和自定义数据结构的设计与实现。
摘要由CSDN通过智能技术生成

环境搭建

Vmware虚拟机

Ubuntu20.04

执行官方提供的shell脚本下载环境依赖

vscode remote

 

先看主函数

#include "socket.hh"
#include "util.hh"

#include <cstdlib>
#include <iostream>

using namespace std;

void get_URL(const string &host, const string &path) {
    // Your code here.

    // You will need to connect to the "http" service on
    // the computer whose name is in the "host" string,
    // then request the URL path given in the "path" string.

    // Then you'll need to print out everything the server sends back,
    // (not just one call to read() -- everything) until you reach
    // the "eof" (end of file).

    cerr << "Function called: get_URL(" << host << ", " << path << ").\n";
    cerr << "Warning: get_URL() has not been implemented yet.\n";
}

int main(int argc, char *arg
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值