建立网路伺服器时,用户端无法确认HTTP 200 OK画面 [英] Building a webserver, client doesn't acknowledge HTTP 200 OK frame

查看:48
本文介绍了建立网路伺服器时,用户端无法确认HTTP 200 OK画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于教程构建自己的Web服务器.我发现了一种简单的方法来启动TCP连接并发送一段HTTP数据(网络服务器将在微控制器上运行,因此它将非常小)

I'm building my own webserver based on a tutorial. I have found a simple way to initiate a TCP connection and send one segment of http data (the webserver will run on a microcontroller, so it will be very small)

无论如何,以下是我需要经历的顺序:

Anyway, the following is the sequence I need to go through:

  1. 接收SYN

  1. receive SYN

发送SYN,ACK

接收ACK(现已建立连接)

receive ACK (the connection is now established)

使用HTTP GET命令接收ACK

receive ACK with HTTP GET command

发送ACK

使用HTTP数据发送FIN,ACK(例如200 OK)

send FIN,ACK with HTTP data (e.g 200 OK)

接收到FIN,ACK<-我没有收到这个数据包!

receive FIN,ACK <- I don't recieve this packet!

发送ACK

一切正常,直到我发送确认和HTTP 200 OK消息.客户端不会向这两个软件包发送确认,因此没有显示网页.我已经添加了一个序列的pcap文件,该序列是我如何使用Wireshark录制的.

Everything works fine until I send my acknowledgement and HTTP 200 OK message. The client won't send an acknowledgement to those two packages and thus no webpage is being displayed. I've added a pcap file of the sequence how I recorded it with wireshark.

Pcap文件: http://cl.ly/5f5/httpdump2.pcap

所有序列号和确认号均正确,校验和正常.标志也正确.我不知道出了什么问题.

All sequence and acknowledgement numbers are correct, checksum are ok. Flags are also right. I have no idea what is going wrong.

推荐答案

因此,IP长度字段的计数过多了8位.我在计算中犯了一个错误.一切现在都像魅力一样!

The IP length field was consequently counting 8 bits too much. I made a mistake in my calculations. Everythings works like a charm now!

这篇关于建立网路伺服器时,用户端无法确认HTTP 200 OK画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆