Multi-Protocol Port Sharing via HTTP Listening Structure Extension
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
When multiple protocols, such as HTTP and RTMP, share the same port in an Nginx architecture, connection requests are randomly processed by either protocol, leading to data anomalies.
Innovation Solution
A designated field is added to the listening structure of the HTTP protocol to store the listening structure of the RTMP protocol, allowing the HTTP protocol to uniformly listen shared ports and detect the target protocol for correct processing, thereby avoiding data anomalies.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If multiple protocols (HTTP and RTMP) share the same port, then port utilization and resource efficiency are improved, but data anomalies occur due to random protocol assignment
Solution Approach 1:
The patent introduces a protocol detection mechanism as an intermediary between the shared port and the protocol processing units. When a connection request arrives at the shared port, the detection mechanism identifies the actual protocol type and routes it to the appropriate processor, preventing random assignment and ensuring data processing accuracy while maintaining port sharing capability
Solution Approach 2:
The patent segments the protocol processing by separating the port listening function from the protocol handling logic. The HTTP protocol's listening structure is enhanced to include a designated field that stores RTMP protocol listening information, allowing the system to distinguish between different protocols even when they share the same port, thus resolving the conflict between port sharing and reliable protocol-specific processing
2Measurement precision
If a designated field is added to the HTTP listening structure to store RTMP listening structure, then protocol detection accuracy is improved, but system complexity increases
Solution Approach 1:
The patent implements a nested structure where the RTMP protocol listening structure is embedded within the HTTP protocol's listening structure through a designated field. This allows the system to maintain both protocol structures without creating entirely separate systems, achieving high protocol detection accuracy while managing complexity through hierarchical organization rather than parallel structures
Data Source
AI summary
The present disclosure discloses a method and system for sharing a multi-protocol port and a server, where a designated field for storing a listening structure is newly added to a listening structure of an HTTP protocol. The method includes: writing, with respect to a target port, a listening structure of an RTMP protocol into the designated field of the HTTP protocol if the HTTP protocol and the RTMP protocol share the target port; detecting a target protocol corresponding to a connection request when the connection request is received by the target port; and reading the listening structure of the RTMP protocol from the designated field to obtain configuration information of the RTMP protocol if the target protocol is the RTMP protocol, and processing the connection request using the configuration information of the RTMP protocol.


