实验四 Web服务器1-socket编程

socket编程

实验要求:

基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用Linux Socket实现:
time服务器的客户端服务器,提交程序运行截图
echo服务器的客户端服务器,提交程序运行截图,服务器把客户端传进来的内容加入“服务器进程pid 你的学号 姓名 echo :”返回给客户端
服务器部署到华为云服务器,客户端用Ubuntu虚拟机。
要用多线程或者多进程实现,至少连接两个客户端。
把服务器部署到试验箱。(加分项)

实验需要用到的码云链接:

csapp.c:

https://gitee.com/wu-longcan/wlc/blob/master/csapp.c

timeserver.c:

https://gitee.com/wu-longcan/wlc/blob/master/timeserver.c

timeclient.c:

https://gitee.com/wu-longcan/wlc/blob/master/timeclient.c

echoserver.c:

https://gitee.com/wu-longcan/wlc/blob/master/echoserver.c

echoclient.c:

https://gitee.com/wu-longcan/wlc/blob/master/echoclient.c

实验过程

1.查看虚拟机的ip地址

2.time服务器的客户端服务器

编译


运行:
先运行timeserver.c再运行timeclient.c

3.echo服务器的客户端服务器

编译:


运行:

4.服务器部署到华为云服务器,客户端用Ubuntu虚拟机

服务器端响应:

posted @ 2022-11-30 13:22  乌龍茶  阅读(35)  评论(0)    收藏  举报