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应用的首选。这项技术的工程价值在于将网络协议知识转化为高可用的线上服务,需要系统性地处理连接管理、消息可靠性和状态同步等复杂问题。在实际应用场景中,即时通讯已从在线聊天扩展到协同编辑、实时通知、直播互动等多个领域,对前端开发者的工程化能力提出了更高要求。 阅读详情

相关推荐

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

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

weixin_33919950的博客 415

Jetty9源码剖析 - Connection组件 - HttpChannel

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

qq_41084324的博客 969

【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... 150

websocket全双工协议

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

weixin_34187862的博客 424

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

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

weixin_31569663的博客 1491

国央企创新负责人如何通过平台提升技术需求挖掘与资源配置的精准性?.docx

国央企创新负责人如何通过平台提升技术需求挖掘与资源配置的精准性?

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

两路半桥LLC谐振变换器软开关Simulink仿真(模拟谐振参数不同、分裂电容)

内容概要:本文介绍了“两路半桥LLC谐振变换器软开关Simulink仿真”资源包,重点在于基于Simulink平台对两路半桥LLC谐振变换器进行高精度建模与动态仿真,特别考虑了谐振参数不一致及分裂电容等非理想工况对系统性能的影响。该仿真模型不仅涵盖了主电路拓扑、软开关实现机制与谐振网络设计,还深入分析了不同参数配置下系统的启动特性、稳态效率、动态响应及软开关条件的满足情况。通过参数扫描与对比仿真,帮助用户掌握LLC变换器的关键设计要素与优化方法,具备较强的工程指导价值和科研教学意义。; 适合人群:电力电子、电气工程及其自动化等相关专业的高校师生,以及从事高频开关电源、新能源变换器、车载充电机等领域的研发工程师和技术人员。; 使用场景及目标:① 掌握两路并联半桥LLC谐振变换器的建模与仿真方法;② 理解软开关技术在提升变换器效率与降低EMI方面的关键作用;③ 分析谐振参数偏差与分裂电容结构对系统均流特性、增益曲线及软开关范围的影响;④ 支持科研项目中的拓扑验证、控制策略开发与故障工况分析; 阅读建议:建议结合Simulink仿真模型与配套说明文档进行学习,重点关注谐振腔参数设置、驱动时序设计及软开关波形观测;可通过调整谐振电感、电容值或引入参数失配,观察系统行为变化,深入理解LLC变换器的稳定边界与优化设计原则。

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

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

weixin_34262482的博客 323

双向全桥CLLC谐振变换器仿真模型(Simulink仿真实现)

内容概要:本文系统介绍了双向全桥CLLC谐振变换器的Simulink仿真模型,重点阐述了变频控制、闭环仿真及其与多种电力电子拓扑(如维也纳整流器、DAB变换器、图腾柱PFC等)的联合仿真设计。资源包涵盖2.5kW双向全桥LLC、V2G电动汽车充放电系统、三相PFC、多相交错LLC等多种变换器的仿真案例,并深入展示了三电平VIENNA整流器在双闭环PI控制与SVPWM调制策略下,结合上下电容电压差值补偿实现中点电位平衡的先进控制方法。通过仿真验证,该策略不仅有效维持了800V直流母线电压的稳定,还在动态工况下显著提升了电容电压的均衡度,同时保持了较低的输入电流THD,充分体现了SVPWM与中点平衡控制协同优化的技术优势。; 适合人群:具备电力电子与自动控制理论基础,从事新能源发电、电动汽车、工业电源、微电网等领域的研究生、工程师及科研人员。; 使用场景及目标:① 学习并构建高频谐振变换器(如LLC、CLLC)的Simulink仿真模型,掌握其变频与混合控制策略;② 深入理解并应用中点电位平衡、双闭环PI控制、SVPWM调制等核心技术于VIENNA等三电平变换器中;③ 复现高水平期刊论文中的控制算法,服务于科研项目申报、学术论文撰写或工程产品开发。; 阅读建议:该资源为综合性仿真资料库,建议使用者结合自身研究方向(如电动汽车充电、新能源并网)选择对应案例进行精学,重点关注控制策略的设计逻辑、仿真参数的整定方法以及SVPWM与中点平衡的协同机制,并充分利用附带的计算书和参考文献深化理解,以实现从仿真模型到实际工程应用的顺利转化。

全桥LLC谐振(变频+移相混合控制)变换器闭环仿真模型(Simulink仿真实现)

全桥LLC谐振(变频+移相混合控制)变换器闭环仿真模型(Simulink仿真实现)

WebSocketFrameEncoder&WebSocketFrameDecoder源码浅析

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

pscool的博客 395

5G NR 帧结构

本节主要介绍5G NR中的帧结构[38.211-4.3]。5G帧结构(Frame Structure)为时域结构。其设计比其4G LTE更为灵活,这种灵活性使5G能够根据应用需求(如增强移动宽带eMBB,超高可靠低时延通信URLLC)进行调整,同时支持差异化的应用场景,提高了5G的利用效率与响应能力。具体而言,5G帧结构是基于时隙和OFDM符号设计的,且5G网络能够根据服务需求动态调整各时隙持续时长。

夫子喵的博客 5287

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

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

weixin_34162228的博客 527

txt经纬度批量转面要素(附自定义ArcGIS工具箱方法)

当涉及大量txt坐标文件需要转换成面要素的时候,逐步操作工作量较大。本文由需求出发,以ArcGIS10.2为例,采用python脚本自定义ArcGIS工具,实现批量操作的目的。

m0_59216200的博客 1820

携程酒店数据爬取进阶:动态接口破解与反反爬策略实战

本文详细解析了携程酒店数据爬取的进阶技巧,包括动态接口参数破解、反爬虫策略对抗及企业级采集方案实现。重点介绍了eleven参数的生成逻辑、动态Cookie维护方法,以及如何应对携程的请求指纹检测和行为模式识别。通过实战案例,帮助开发者高效获取酒店价格数据,同时遵守行业规范。

eee77的博客 1081

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

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

weixin_43924419的博客 484

避坑指南:LISFLOOD-FP模型数据单位、参数文件与results文件夹结果解析全攻略

本文详细解析了LISFLOOD-FP洪水模拟模型的关键应用环节,包括数据单位校验、参数文件优化及结果文件解读与可视化。特别针对常见的单位混淆问题,提供了从DEM到边界条件的全面校验方法,并深入剖析了.par参数文件的配置技巧,帮助用户避免模型崩溃和结果失真。

weixin_42533622的博客 237

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

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

y67540的专栏 1748

Python小白也能玩转迅投QMT量化交易?手把手教你从安装到第一个策略

本文为零基础Python用户提供了上手迅投QMT量化交易平台的完整指南。从Python 3.6环境配置、QMT客户端获取安装,到核心概念讲解,并手把手教你编写并回测一个经典的双均线交易策略,帮助初学者快速迈出量化交易的第一步。

weixin_29103191的博客 764

企业级托管钱包架构设计与MPC密钥管理:基于Go语言的生产级实践

本文探讨了2026年Web3生态中企业级托管钱包的技术架构与实现方案。文章指出,传统私钥管理模式已无法满足机构级资产管理需求,而基于多方安全计算(MPC)和门限签名(TSS)的技术方案成为主流选择。研究分析了托管钱包的四层架构设计,详细解读了MPC的核心技术原理,包括分布式密钥生成(DKG)和签名协议演进。通过Go语言实现案例,展示了密钥分片管理、DKG流程和交易签名等核心模块的代码实现。文章还提出了生产部署的安全原则、容灾设计和监控体系,并讨论了密钥撤销等现存挑战及TEE融合等未来趋势。研究为构建安全、高

分享AI、区块链技术及应用,未来已来 81

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万+

【CUDA Runtime】第一个“Hello World“程序

CUDA(Compute Unified Device Architecture)是 NVIDIA 提供的一个并行计算平台和编程模型,旨在通过利用 GPU 的强大计算能力来加速计算密集型应用。对于许多开发者而言,开始学习 CUDA 编程的第一步通常是编写一个简单的“Hello World”程序。尽管 CUDA 的实际应用远远超出一个简单的例子,但这个初步的示例能帮助开发者快速入门,理解基本的 CUDA 编程流程。

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

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值