Full-Duplex Channel over HTTP

H3C S1248交换机配置指南:VLAN、端口镜像与ACL实战 在企业网络架构中,二层交换机是实现局域网内设备互联和数据转发的核心基础设备。其工作原理基于MAC地址表学习与转发,通过隔离广播域和实现端口间高速交换,为网络提供稳定、高效的接入能力。这项技术的核心价值在于提升网络性能、增强安全性和简化管理,广泛应用于办公网络、监控系统及数据中心接入层等场景。以H3C S1248这款经典的48口全千兆管理型交换机为例,它集成了智能监控和流量管理功能,是构建可靠企业网络的理想选择。本文将聚焦于其VLAN划分、端口镜像和ACL访问控制等关键功能的配置实践,帮助网络工程师快速掌握部 阅读详情

Many people are trying to (mis)use HTTP to create a full-duplex connection between the client and server. However, there are a number of problems in doing so. I will try to explain here what they are, and under what circumstances you can possibly get it to work. At the end is also a method that doesn't actually use HTTP at all, but is related.

The first thing to note is that HTTP uses a request-response paradigm, not a full-duplex streaming paradigm. Let me repeat that: HTTP is a request-response protocol! This means that the client sends a request, and when the complete request has been sent then the server sends the response. This is the case even if so-called keep-alive is used, i.e. multiple requests are sent over the same TCP connection. Because this behaviour is fundamental to the protocol most implementations make certain (valid) assumptions which make it difficult to create a full-duplex connection.

If you are wanting to create a full-duplex connection through HTTP then you must first ask yourself why. Why not just use TCP? After all, that's exactly what TCP gives you. The reasons I usually hear are that 1) you don't want to write a standalone server, but instead want to use the web server that's already running; or 2) the application needs to work through a firewall, and the only way to get through it is by using HTTP. Unfortunately, the work involved to get it working will probably negate any advantages 1) might seem to offer, so that only 2) is a reasonable argument.

OK, down to the details. We'll first discuss the problems when no proxy is involved, and then discuss the added problems a proxy generates.

Direct Client-Server Connection

The problems here are the following.

streaming request data (client->server):
HTTP/1.0 requires all requests with a body to have a Content-Length header. In theory you could just send a very big Content-Length, but this will often conflict with the second point below. HTTP/1.1 allows you use the chunked transfer encoding instead which enables you to send an "unknown" amount of data. However, to date not many servers will accept such a request (I only know of one, and it's not in widespread use), and it still doesn't solve the next point. If they do accept such requests then you'll need to use some server specific API (NSAPI, Apache-module, etc) to receive and process the request - cgi scripts can't handle such requests because they require a Content-Length and that is not available when using the chunked transfer encoding.
responses aren't sent until the complete request is received:
Some servers will first require the complete request to be received and processed before any part of the response is sent. This means that all you get is a half-duplex stream.

In summary, you may be able to get your server to provide you with a full-duplex connection, but chances are it would be easier to write your own (non-HTTP) server. Furthermore, using your own server is probably more efficient as HTTP servers are not designed for long requests and responses (you usually tie up a process or thread per connection).

Additional Problems when going through a Proxy

When proxies are involved the above mentioned problems are compounded - now both the proxy (or proxies) and the server must fulfill the necessary requirements. I've especially seen the second point above as the major problem when going through a proxy: the proxy will wait until it has the complete request before forwarding it to the server. Additionally, while you may have control over the server (to the point of being able to write your own), you (generally) don't have any control over the proxy. This means you must assume the worst case for the proxy.

Furthermore, if you are writing an applet and don't sign it then you must use the browser's HTTP client (via java.net.URLConnection - see Applet Network Security Policy for why). Unfortunately, these clients all first buffer the complete request data (i.e. everything written to the stream from URLConnection.getOutputStream()) before even sending the request, thereby preventing you from creating a true client->server stream.

Solutions

The easiest solution is to change your application to use a request-response paradigm. If you are trying to tunnel through an HTTP proxy and for some reason really can't change your paradigm, then here are a couple ideas.

Use 2 connections:
Each connection gives you a simplex stream. Do a simple GET on the first connection and have the server send back a response either without a Content-length header or with a very large Content-length header (or if you're doing HTTP/1.1 you can use the chunked transfer encoding). Also, send the " Pragma: no-cache" and " Cache-Control: no-cache" headers to keep any proxy from caching the response. This response will then give you the server->client simplex stream. Then do a POST with a very large Content-length header on the second connection to get the client->server stream (the response is never received). Note that this won't work with a number of proxies because they will never forward the POST (because they're waiting for the complete data).
Use n+1 connections:
If you are using URLConnection or going through certain proxies then you won't get real client->server stream (because they buffer it all before sending the request). Therefore you must split your client->server stream into blocks and send each block in a separate request. The server->client stream is done as above. Note however that this solution may potentially mean you'll be sending a large number of requests, and if your server or proxy doesn't handle keep-alives then that also means a large number of connections being created.

In either case you will still have either write your own (simple) HTTP server, or then write some server side handler using an API native to the server.

Alternate Solution: TCP tunnel

There's an alternate solution that will give you a full-duplex TCP connection and will work through (virtually) all HTTP proxies. It usually requires that your write your own server, though. The trick is to note that when using HTTPS (HTTP over SSL/TLS) a proxy cannot look into the data stream (since it's encrypted), and therefore can't do any HTTP processing, i.e. get in the way. Instead, when you send the proxy the CONNECT request it turns itself into a simple tunnel, which is exactly what we want.

So, instead of using port 80 use port 443. In the case of transparent proxies (where ISP's reroute all port 80 traffic through a proxy of theirs) you'll automatically avoid going through the proxy; in the case of explicit proxies, for each connection you open you need to first send the CONNECT request and process the response, after which you have full-duplex connection to your server. Note that in most (all?) cases you needn't actually run SSL/TLS, as the proxies don't inspect the data stream to see what exactly you're sending through the tunnel.

One drawback remains: this doesn't work well in applets because you can't use URLConnection for this, but instead you need to use a Socket directly. This means it can't be used in unsigned applets at all, and in signed applets you have to somehow figure out what, if any, proxy is being used and what, if any, username/password is need to authenticate with the proxy.

 
前端即时通讯实战:从WebSocket协议到工程化架构设计 即时通讯(IM)是实现实时数据交互的核心技术,其本质是基于长连接的双向通信机制。从技术原理上看,前端实现IM主要依赖WebSocket、Server-Sent Events(SSE)和长轮询等协议,其中WebSocket凭借全双工、低延迟的特性成为现代Web应用的首选。这项技术的工程价值在于将网络协议知识转化为高可用的线上服务,需要系统性地处理连接管理、消息可靠性和状态同步等复杂问题。在实际应用场景中,即时通讯已从在线聊天扩展到协同编辑、实时通知、直播互动等多个领域,对前端开发者的工程化能力提出了更高要求。 阅读详情

相关推荐

【10】route,iptables,macvlan,mii/mdio,ncsi,bond,dns,ipv6

如下53134相当于一个小的switch交换机(固件文件小,所以用eeprom,bmc用spi去升级这个eeprom),53134 port1口给bmc,port2口给cpu,一根网线,cpu和bmc都有不同的ip。bmc中ifconfig会多出eth1(顺位,原来有eth0,不是eth3),ssh admin@eth1_ip和ssh root@eth1_ip能登上cpu和bmc,cpu端ifconfig没变化,如下phy-mode不写也可以。如下在烧录的机器上烧录镜像后,vi第一行.dep文件。

持续更新ing... 158

Jetty9源码剖析 - Connection组件 - HttpChannel

转载自ph0ly:http://www.ph0ly.com 一、概念 HttpChannel主要协助HttpConnection触发Server或Handler的处理操作,它内部会包装本次请求对应的Request、Response,并控制它们的生命周期。HttpChannelOverHttp是增强的HttpChannel,它对外暴露请求的参数处理接口(包括请求行、请求头、请求体等)。HttpC...

qq_41084324的博客 969

跨平台实时音频处理库PortAudio项目实战

PortAudio作为一个开源、跨平台的音频I/O库,为开发者提供了统一的接口来实现低延迟、高性能的实时音频处理。其核心设计目标是屏蔽底层操作系统音频子系统的差异,使得同一套代码能够在Windows(WASAPI、DirectSound)、macOS(Core Audio)以及Linux(ALSA、PulseAudio)等不同平台上无缝运行。该库通过抽象化设备访问逻辑,将音频流的启动、数据回调、缓冲管理等关键环节封装为简洁的C API,极大降低了跨平台音频开发的复杂度。

weixin_31569663的博客 1497

websocket全双工协议

websock简介 WebSocket协议是基于TCP的一种新的协议。WebSocket最初在HTML5规范中被引用为TCP连接,作为基于TCP的套接字API的占位符。它实现了浏览器与服务器全双工(full-duplex)通信。 渊源 http协议设计之初,由于考虑到服务端如果能主动地让浏览器端推送广告的情况,所以我们现在所使用的http协议并不能由服务器端主动地向浏览器端发送数据。 发展与需求的...

weixin_34187862的博客 424

Vivado FPGA 工程模板:参数化消抖、PWM 与 XDC 约束

这份工程模板解决 FPGA 起步阶段的工程骨架与踩坑问题。含可综合的参数化按键消抖(两级同步消亚稳态)、参数化 PWM(0/满占空比边界修复)、顶层呼吸灯示例、XDC 时钟与 IO 约束模板、Tcl 一键建工程脚本。面向 STM32 开发者向 FPGA 扩展,换 Artix-7/Kintex/Zynq 只需改器件与引脚。

四旋翼无人机模糊自适应PID控制,俯仰姿态控制律设计研究(Matlab代码、Simulink仿真实现)

内容概要:本文围绕四旋翼无人机的俯仰姿态控制问题,深入研究了模糊自适应PID控制律的设计与实现。通过结合模糊逻辑系统的自适应能力与传统PID控制器的稳定性,构建了一种能够在复杂动态环境中有效应对外部扰动和模型不确定性的先进控制策略。研究详细阐述了控制系统的结构设计、模糊规则库的建立、隶属度函数的选取以及PID参数的在线调整机制,并利用Matlab/Simulink工具进行了完整的建模与仿真实验,验证了所提方法在响应速度、超调量和抗干扰能力等方面相较于传统PID控制的显著优越性。; 适合人群:具备自动控制理论基础和Matlab/Simulink仿真经验的自动化、航空航天及相关专业的本科生、研究生及科研人员。; 使用场景及目标:①学习和掌握模糊自适应PID控制器的设计原理与方法;②研究无人机姿态控制算法的性能提升途径;③完成相关课程设计、毕业设计或科研项目的仿真验证工作。; 阅读建议:建议读者结合Matlab代码与Simulink模型,深入理解控制算法的实现细节,并尝试调整系统参数和仿真条件,以探究不同因素对控制性能的影响,从而达到理论与实践相结合的学习目的。

too much data seeking EOF in CLOSE for HttpChannelOverHttp

测试某个请求的时候报了这个错误: .... too much data seeking EOF in CLOSE for HttpChannelOverHttp 产生这个原因的问题有很多,但是大多数都是数据格式错误造成的,我的接口的接收对象是这样的: class { name, age List childList } 但是我传递的参数中childList是这样的: { "n...

流浪的神明 682

复现基于李雅普诺夫的多个欠驱动无人船协同路径跟踪Matlab仿真

内容概要:本文详细介绍了基于李雅普诺夫稳定性理论的多个欠驱动无人船协同路径跟踪控制方法的Matlab仿真研究。通过建立非线性动力学模型,设计分布式协同控制器,并利用李雅普诺夫函数严格证明系统的渐近稳定性,实现了多艘无人船在复杂海洋环境下的高精度路径跟踪与稳定编队保持。文中系统阐述了控制器的设计原理、稳定性分析过程、仿真参数配置及多种典型场景下的仿真实验结果,充分验证了该方法在提升编队协同性、抗外部干扰能力和鲁棒性方面的显著优势。; 适合人群:具备自动控制理论、非线性系统分析基础以及Matlab/Simulink仿真能力的研究生、科研人员,以及从事无人系统、船舶自动化、多智能体协同控制等领域研发工作的工程师。; 使用场景及目标:①用于多智能体系统协同控制算法的研究与教学示范;②为欠驱动船舶的路径跟踪控制、海上集群航行等实际工程应用提供可靠的算法设计思路与仿真验证平台;③支撑相关领域高水平论文撰写、科研项目申报与关键技术攻关。; 阅读建议:建议读者结合提供的Matlab代码逐模块研读,重点关注李雅普诺夫函数的构造技巧与控制器参数的整定方法,并尝试在不同环境扰动(如海流、风浪)下进行仿真实验,以深入理解系统的鲁棒性与适应性。

STM32与MAX11108A高精度ADC信号采集系统设计

模数转换器(ADC)是将模拟信号转换为数字信号的核心器件,其性能直接影响测量系统的精度。SAR型ADC因其转换速度快、功耗低的特性,在工业测量和医疗设备中广泛应用。MAX11108A作为12位8通道ADC,通过SPI接口与STM32微控制器通信,构建了灵活的信号采集系统。该系统设计涉及硬件电路优化、软件滤波算法和噪声抑制技术,可实现200ksps采样率下的高精度数据采集。在环境监测、便携医疗设备等场景中,这种组合方案既满足了实时性要求,又保持了低功耗特性,为物联网终端设备提供了可靠的信号采集解决方案。

weixin_34262482的博客 324

无线通信工业级双频大功率无线AP基站:2.4G+5GHz全频段高带宽抗干扰设备在智慧物流与工业自动化场景中的应用

内容概要:斯普莱WiFiSupply WFS7000BDIAC是一款2.4G+5GHz双射频、支持1166Mbps无线速率的电信工业级室外型大功率无线AP基站,具备31dBm×2发射功率、IP68防护等级、-45~85℃宽温工作能力及20万小时MTBF认证,支持TDMA时分多址、AI智能FastRoaming极速漫游(≤30ms)、≤1ms通信延迟等核心技术,适用于复杂电磁环境与恶劣气候下的全天候运行。设备采用4T4R MIMO架构,支持多档频宽调节、链路聚合、高带机量及远距离覆盖(3km以上),选配高增益天线可实现150km以上桥接传输,广泛应用于智慧物流、工业4.0、AGV/AMR、驾考系统、森林防火、车载船载视频等场景。; 适合人群:从事工业无线网络设计、智能制造系统集成、智慧交通与物流信息化的工程技术人员及项目决策者;具备一定网络基础知识并负责无线覆盖方案选型、部署与运维的专业人员。; 使用场景及目标:①在大型仓库、四向穿梭车立体库、PLC产线等工业自动化场景中构建高稳定、低时延无线网络;②为AMR/AGV、堆垛机、无人机、教练车等移动设备提供无缝漫游与实时控制连接;③实现远距离无线桥接与视频回传,如森林防火监控、车载视频传输等;④满足极端环境下(高寒、高温、强电磁干扰)对网络可靠性与安全性的严苛需求; 阅读建议:此文档适用于方案设计前期选型参考,建议结合“产品参数”与“行业应用”章节进行组网模式匹配分析,并重点关注TDMA、FastRoaming、巨量安全隧道等专有技术在实际场景中的适配性,同时核实相关认证信息以确保合规部署。

Gemini 3.1 Flash本地部署实操:Ollama+Open WebUI零门槛运行指南

大型语言模型(LLM)本地运行是指将模型权重下载至本地设备,通过推理引擎完成离线推理的过程;其核心原理依赖量化压缩(如GGUF格式)与轻量级运行时(如Ollama)实现CPU/GPU高效加载;技术价值在于低延迟响应、数据隐私可控及免网络依赖;典型应用场景包括办公提效(邮件/周报生成)、学生学习辅助、产品原型验证等边缘AI任务;本文聚焦Gemini 3.1 Flash这一面向消费级硬件优化的轻量模型变体,结合Ollama模型管理与Open WebUI图形界面,提供从环境准备、模型拉取到流式对话的完整新手实操路

weixin_32238157的博客 522

WebSocketFrameEncoder&WebSocketFrameDecoder源码浅析

HTTP已经诞生了数十年,具有广泛的应用,各种优化专门的优化机制也已经被浏览器及服务器等设备实施,XHR 请求自然而然就继承了所有这些功能。然而,对于只使用HTTP协议完成升级协商的WebSocket来说,流式数据处理可以让我们在客户端和服务器间自定义协议,但也会错过浏览器提供的很多服务,应用可能必须实现自已的逻辑来填充某些功能空白,比如缓存、状态管理、元数据交付等等。

pscool的博客 395

双系统引导修复:GRUB消失后恢复Windows与Ubuntu启动菜单

在UEFI引导架构下,操作系统启动依赖于EFI系统分区(ESP)中存储的引导加载程序。当多个系统共存时,引导管理器负责识别并加载不同操作系统的引导文件。然而,Windows更新或系统调整时常会重置UEFI启动顺序,导致GRUB引导菜单消失,直接进入Windows。这一问题的技术价值在于理解UEFI启动流程与多系统引导管理机制,掌握ESP分区结构与引导文件修复方法。常见的应用场景包括双系统安装后的引导修复、系统更新后的启动项丢失以及磁盘分区调整导致的引导故障。本文针对**GRUB引导菜单消失**和**UEFI

weixin_29895109的博客 298

PHP构建高可用WebSocket推送系统:从Workerman到Redis分布式架构

在Web开发中,实时消息推送是提升用户体验的关键技术,其核心在于解决服务器向客户端主动推送数据的通信问题。传统基于HTTP的短轮询和长轮询方案存在高延迟与资源浪费的瓶颈,而WebSocket协议通过建立全双工长连接,实现了真正的低延迟双向通信。对于PHP这类常与Web服务器耦合的语言,构建常驻内存的推送服务需要借助Workerman或Swoole等框架,它们封装了底层Socket和事件循环,使开发者能专注于业务逻辑。然而,单机多进程架构面临连接隔离和消息广播的挑战,此时引入Redis的发布订阅机制成为关键,

weixin_34162228的博客 527

在微信小程序中如何引入iconfont

略

sayyy的专栏 4332

【赛题解析&命令脚本配置】2023年全国职业院校技能大赛GZ073网络系统管理赛项赛题第9套模块A:网络构建 & (三)无线网络配置+(四)出口网络配置-命令配置

【赛题解析&命令脚本配置】2023年全国职业院校技能大赛GZ073网络系统管理赛项赛题第9套模块A:网络构建 & (三)无线网络配置+(四)出口网络配置-命令配置

君逍遥o 1024

TCP 详解:从协议原理到 Java 长连接实现

TCP 详解:从协议原理到 Java 长连接实现

weixin_43924419的博客 488

基于matlab的CNN验证码识别系统(UI界面版)

基于matlab的CNN验证码识别系统(UI界面版),CNN验证码识别系统包括数据集处理、模型搭建、模型训练、界面设计与实现

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 491

STM32 RFID管理系统实战:从硬件选型到状态机设计的完整指南

嵌入式系统开发中,硬件选型、通信协议与数据管理是构建稳定应用的核心基础。通过SPI、UART等通信接口,微控制器(如STM32)可与RFID读卡器等外设进行可靠数据交换,其关键在于理解底层驱动原理与中断机制。在物联网与自动化领域,这种技术组合能实现高效的物品识别与状态管理,具有广泛的应用价值。本文以STM32和RC522模块为例,深入剖析了从SPI驱动移植、电源管理到状态机设计的全流程,并针对数据存储策略与系统联调中的常见问题提供了解决方案,帮助开发者构建如智能图书馆、智能鞋柜等可稳定运行的RFID管理系统

weixin_33919950的博客 415

华为OD机试真题 新系统 9月20号 【字符串分组求和】

华为OD新系统机试真题【字符串分组求和】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【字符串分组求和】解析。

qq_45776114的博客 658

VIVADO IP核之FIR插值器多相滤波仿真

网络上有许多文章介绍FIR低通滤波器的使用,包括仿真。关于FIR低通滤波器的使用,我之前的文章已经介绍过了,本文将继续深入介绍FIR插值器多相滤波的使用方法,并将FIR插值多相滤波的结果与MATLAB仿真计算的结果比较,验证了FIR插值器多相滤波使用正确。

m0_66360845的博客 3390

spring mvc接受post数据过大,参数获取为空的解决方法

最近用jetty  跑spring mvc接收post请求(post中数据很大)。出现数据无法获取到的问题。 如  @RequestMapping(value = "/receive", method = RequestMethod.POST) public receive(String a,String b,String c)  其中 a是从post中获取,先前数据量小的时候,可

arsenal04的专栏 1万+

基于STM32、HAL库的MCP4013T-103E/CH 数字电位器驱动程序设计

define MCP4013_I2C_ADDR (0x5F << 1) // HAL库使用7位地址左移1位,或直接使用0xBE/0xBF。#include "i2c.h" // 包含你的I2C初始化相关的头文件,例如由CubeMX生成的 i2c.h。大于127的值会被截断。// MCP4013的读操作:主机发起读取请求,从机返回当前滑片位置的一个字节。// 使用HAL_I2C_Master_Transmit直接发送数据。// 使用HAL_I2C_Master_Receive读取一个字节。

corlin6688的博客 130

WebSocket: HTML5一种新的协议, 实现浏览器与服务器全 双工通信(full-duplex)

现很多网站为了实现即时通讯,所用的技术都是轮询(polling)。轮询是在特定的的时间间隔(如每1秒),由浏览器对服务器发出HTTP request,然后由服务器返回最新的数据给客户端的浏览器。这种传统的HTTP request 的模式带来很明显的缺点 – 浏览器需要不断的向服务器发出请求,然而HTTP request 的header是非常长的,里面包含的有用数据可能只是一个很小的值,这样会占用很

y67540的专栏 1751

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

上一篇: 几种建立http-tunnel的方法
下一篇: HttpTunnel工作原理及源程序分析
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值