CN114143291B - HTTP communication method and system based on TCP and UDP - Google Patents
HTTP communication method and system based on TCP and UDP Download PDFInfo
- Publication number
- CN114143291B CN114143291B CN202111368223.XA CN202111368223A CN114143291B CN 114143291 B CN114143291 B CN 114143291B CN 202111368223 A CN202111368223 A CN 202111368223A CN 114143291 B CN114143291 B CN 114143291B
- Authority
- CN
- China
- Prior art keywords
- user
- called user
- invitation request
- calling
- session
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000004891 communication Methods 0.000 title claims abstract description 29
- 238000000034 method Methods 0.000 title claims abstract description 22
- 230000005540 biological transmission Effects 0.000 abstract description 10
- 238000012546 transfer Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000013144 data compression Methods 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1069—Session establishment or de-establishment
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/163—In-band adaptation of TCP data exchange; In-band control procedures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/164—Adaptation or special uses of UDP protocol
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Multimedia (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses an HTTP communication method and a system based on TCP and UDP, which are used for receiving a calling user invitation request sent by a TCP protocol and a UDP protocol and replying calling user response information according to the calling user invitation request; and obtaining the information of the called user according to the invitation request of the calling user, and sending the invitation request of the called user to the called user according to the information of the called user so as to obtain the response of the called user and establish a session with the calling user. Introducing a UDP-based SIP service as a proxy server of the HTTP; when the HTTP request is made, on one hand, the former TCP mode is still used, meanwhile, the SIP mode of UDP can be used, TCP transmission can be carried out in a weak network environment, meanwhile, the SIP service which can use UDP can enhance the success rate of the HTTP request and reduce the time consumption of the HTTP request, so that the communication success rate of a client and a server is ensured, and the communication efficiency is improved.
Description
Technical Field
The invention relates to the technical field of internet transmission, in particular to an HTTP communication method and system based on TCP and UDP.
Background
Wireless network communications are relatively more environmentally affected (e.g., high-rise buildings, user movement, environmental noise, relatively closed environments, etc.) than wired network communications, and the quality of service of the network is relatively not very stable, resulting in users often communicating in a weak-signal network environment. When a user communicates in such a network environment, there are many situations such as packet loss, error codes, timeout, connection interruption, and difficulty in accessing the network. Besides being affected by environment, the communication can also cause wireless call disconnection, service quality degradation and other problems due to network coverage, indoor subsystem imperfection, neighbor cell missing, pilot pollution, overload control and other reasons.
Most of the current use of the TCP/UDP-based data message transmission in the market is that under the circumstance facing weak networks, the TCP frequently fails to connect, especially under the circumstance of weak networks, the TCP establishes frequent links easily fails, which results in failure of requests, and the transmission time is long, which affects the communication quality.
Disclosure of Invention
In view of the above-mentioned drawbacks or shortcomings, an object of the present invention is to provide an HTTP communication method and system based on TCP and UDP.
In order to achieve the above purpose, the technical scheme of the invention is as follows:
An HTTP communication method based on TCP and UDP, comprising:
receiving a calling user invitation request sent by a TCP protocol and a UDP protocol, and replying calling user response information according to the calling user invitation request;
And obtaining the information of the called user according to the invitation request of the calling user, and sending the invitation request of the called user to the called user according to the information of the called user so as to obtain the response of the called user and establish a session with the calling user.
The receiving the calling user invitation request sent by the TCP protocol and the UDP protocol specifically comprises the following steps:
Receiving a data message transmitted by using a TCP protocol;
A SIP service proxy server based on UDP is introduced, and the SIP server unpacks and packages the data packets.
The response information is 100Trying response information.
According to the calling user invitation request, obtaining the information of the called user, and according to the information of the called user, sending the called user invitation request to the called user specifically comprises:
After the information of the called user is obtained, searching the address of the called user, and forwarding the invitation request of the calling user to the called user after obtaining the address.
After receiving the invitation request of the called user, the called user generates 180 ringing responses, and the generated 200OK responses are returned to the calling user.
After receiving the 200OK response, the calling user also sends an ACK to the called user to establish the session.
If not, retry for multiple times; when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
After the session is established, the method further comprises the following steps:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
An HTTP communication system based on TCP and UDP comprises a server group, a calling user and a called user, wherein the server group is used for receiving a message from a user;
The calling user is used for sending a user invitation request to the server group, sending ACK after receiving a response of the called user, and establishing a session;
The server group comprises an SIP server and an HTTP server, and is used for receiving a calling user invitation request sent by a TCP protocol and a UDP protocol and replying calling user response information according to the calling user invitation request; according to the calling user invitation request, obtaining called user information, and sending a called user invitation request to a called user according to the called user information;
the called user receives the request to generate 180 ringing response and returns the generated 200OK response to the calling user.
The server group HIA is used for retrying for a plurality of times if the ACK is not received; when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
After the session is established, the method further comprises the following steps:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
Compared with the prior art, the invention has the beneficial effects that:
The invention provides a HTTP communication method and a system based on TCP and UDP, which introduce SIP service based on UDP as a proxy server of HTTP; when the HTTP request is made, on one hand, the former TCP mode is still used, meanwhile, the SIP mode of UDP can be used, TCP transmission can be carried out in a weak network environment, meanwhile, the SIP service which can use UDP can enhance the success rate of the HTTP request and reduce the time consumption of the HTTP request, so that the communication success rate of a client and a server is ensured, and the communication efficiency is improved.
Drawings
FIG. 1 is a flow chart of a HTTP communication method based on TCP and UDP according to the present invention;
FIG. 2 is a flow chart of a UDP-based HTTP communication method of the present invention;
Fig. 3 is a block diagram of an HTTP communication system based on TCP and UDP according to the present invention.
Detailed Description
The present invention now will be described more fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
Most of the current use of the conventional method in the market is based on the transmission of data packets by TCP/UDP, and in the environment facing weak networks, TCP often fails to connect, so as to solve the problem, in this embodiment, the optimal scheduling and the optimal design of the transport layer protocol are implemented by a new DNS server, for example, data compression, data encryption, and merging of multiple data packets, so as to ensure the success rate of communication between the client and the server, and improve the communication efficiency.
Example 1
As shown in fig. 1, the present invention provides an HTTP communication method based on TCP and UDP, including:
s1, receiving a calling user invitation request sent by a TCP protocol and a UDP protocol, and replying calling user response information according to the calling user invitation request;
the receiving the calling user invitation request sent by the TCP protocol and the UDP protocol specifically comprises the following steps:
Receiving a data message transmitted by using a TCP protocol;
A SIP service proxy server based on UDP is introduced, and the SIP server unpacks and packages the data packets.
Note that, in this embodiment, the response information is 100Trying response information. UDP (User Datagram Protocol ), a connectionless transport layer protocol in the OSI (Open System Interconnection, open systems interconnection) reference model, provides a transaction-oriented simple unreliable information transfer service, and IETF RFC 768 is a formal specification for UDP. TCP (Transmission Control Protocol ), which is a connection-oriented (connection-oriented), reliable, byte-stream-based Transport layer (Transport layer) communication protocol. HTTP (HyperText Transfer Protocol ) is one of the most widely used network protocols on the internet. All WWW files must comply with this standard. S2, obtaining the information of the called user according to the invitation request of the calling user, and sending the invitation request of the called user to the called user according to the information of the called user so as to obtain the response of the called user and establish a session with the calling user.
S2, obtaining the information of the called user according to the invitation request of the calling user, and sending the invitation request of the called user to the called user according to the information of the called user so as to obtain the response of the called user and establish a session with the calling user.
According to the calling user invitation request, obtaining the information of the called user, and according to the information of the called user, sending the called user invitation request to the called user specifically comprises:
After the information of the called user is obtained, searching the address of the called user, and forwarding the invitation request of the calling user to the called user after obtaining the address.
After receiving the invitation request of the called user, the called user generates 180 ringing responses, and the generated 200OK responses are returned to the calling user.
After receiving the 200OK response, the calling user also sends an ACK to the called user to establish the session.
ACK (Acknowledgement character), a transmission class control character that the receiving station sends to the transmitting station in data communication. Indicating that the transmitted data has been acknowledged with no errors. In the TCP/IP protocol, if the receiver successfully receives data, an ACK data is replied. Typically, the ACK signal has its own fixed format and length, and is returned to the sender by the receiver.
Under the weak network environment, retrying for a plurality of times for each UDP request if the ACK is not received; in the sending process, the client has heartbeat, and when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
In addition, after the session is established, the method further comprises:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
As shown in fig. 2, the specific HTTP communication method based on UDP of the present invention is:
TCP transmission is used when data message transmission is carried out;
introducing a UDP-based SIP service proxy server, wherein the SIP server unpacks and packages the UDP packets;
The calling user sends an INVITE request to the proxy server;
the proxy server sends a 100Trying response to the calling user;
The proxy server searches the address of the called user, and forwards the INVITE request after obtaining the address;
180 ringing response generated by the called user is returned to the calling user;
the 200OK response generated by the called user is returned to the calling user;
After receiving the 200OK response of the called party B, the calling party sends an ACK to the called party, and a session is established;
after the session is ended, any participant (calling or called) can send a BYE request to terminate the session;
the calling subscriber sends a 200OK response to acknowledge BYE and the session terminates.
Under the weak network environment, retry is carried out for a plurality of times for each UDP request if no ACK is received; in the sending process, the client has heartbeat, and when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
Example two
As shown in fig. 3, an HTTP communication system based on TCP and UDP includes a server group 1, a calling user 2, and a called user 3, wherein;
The calling user 2 sends a user invitation request to the server group, and sends ACK after receiving the response of the called user, so as to establish a session;
The server 1 group comprises a SIP server 11 and an HTTP server 12, and is used for receiving a calling user invitation request sent by a TCP protocol and a UDP protocol, and replying calling user response information according to the calling user 2 invitation request;
According to the calling user invitation request, obtaining called user information, and sending a called user invitation request to a called user according to the called user information; according to the calling user invitation request, obtaining called user information, and sending a called user invitation request to a called user according to the called user information;
the called user 3 is configured to receive the called user invite request, generate a 180 ringing response, and return the generated 200OK response to the calling user.
After the session is established, the method further comprises the following steps:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
It will be apparent to those skilled in the art that the foregoing is merely illustrative of the preferred embodiments of this invention, and that certain modifications and variations may be made in part of this invention by those skilled in the art, all of which are shown and described with the understanding that they are considered to be within the scope of this invention.
Claims (8)
1. A method for establishing a session based on a SIP server, comprising:
Receiving a calling user invitation request sent by a TCP protocol and a UDP protocol, and replying calling user response information according to the calling user invitation request, wherein the receiving the calling user invitation request sent by the TCP protocol and the UDP protocol specifically comprises the following steps: receiving a data message transmitted by using a TCP protocol; a SIP service proxy server based on UDP is introduced, the SIP server unpacks and packs the data packet, and the response information is 100Trying response information;
according to the calling user invitation request, obtaining the information of the called user, and according to the information of the called user, sending the invitation request of the called user to obtain the response of the called user, and establishing a session with the calling user, wherein according to the invitation request of the calling user, obtaining the information of the called user, and according to the information of the called user, sending the invitation request of the called user to the called user specifically comprises: after the information of the called user is obtained, searching the address of the called user, and forwarding the invitation request of the calling user to the called user after obtaining the address.
2. The method for establishing a session based on the SIP server according to claim 1, wherein the called user receives the called user invite request, generates a 180 ringing response, and returns the generated 200OK response to the calling user.
3. The method for establishing a session based on the SIP server as claimed in claim 2, wherein the calling subscriber further comprises sending an ACK to the called subscriber after receiving the 200OK response, and establishing the session.
4. A method for establishing a session based on a SIP server according to claim 3, wherein if no ACK is received, performing multiple retries; when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
5. The method for establishing a session based on the SIP server according to claim 1, further comprising, after the session is established:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
6. The communication system for establishing session based on the SIP server is characterized by comprising a server group, a calling user and a called user, wherein the calling user and the called user are connected through the SIP server;
The calling user is used for sending a user invitation request to the server group, sending ACK after receiving a response of the called user, and establishing a session;
the server group comprises an SIP server and an HTTP server, and is used for receiving a calling user invitation request sent by a TCP protocol and a UDP protocol and replying calling user response information according to the calling user invitation request, and the receiving of the calling user invitation request sent by the TCP protocol and the UDP protocol specifically comprises the following steps: receiving a data message transmitted by using a TCP protocol; a SIP service proxy server based on UDP is introduced, the SIP server unpacks and packs the data packet, and the response information is 100Trying response information; according to the calling user invitation request, obtaining the called user information and sending the called user invitation request to the called user according to the called user information, wherein the obtaining the called user information and sending the called user invitation request to the called user according to the called user invitation request specifically comprises: after the information of the called user is obtained, searching the address of the called user, and forwarding the invitation request of the calling user to the called user after obtaining the address;
the called user is used for generating 180 ringing response after receiving the invitation request of the called user and generating 200OK response to return to the calling user.
7. The SIP server-based session establishment communication system of claim 6, wherein the server group is configured to perform multiple retries if no ACK is received; when the SIP server sends a message to the client, if the address of the client is found to change, the message is retransmitted to the new address.
8. The SIP server-based session establishment communication system according to claim 6, further comprising, after the session establishment:
The calling user and/or the called user send an end request to terminate the session;
The caller sends an end response to acknowledge the end request, terminating the session.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111368223.XA CN114143291B (en) | 2021-11-18 | 2021-11-18 | HTTP communication method and system based on TCP and UDP |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111368223.XA CN114143291B (en) | 2021-11-18 | 2021-11-18 | HTTP communication method and system based on TCP and UDP |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114143291A CN114143291A (en) | 2022-03-04 |
CN114143291B true CN114143291B (en) | 2024-08-13 |
Family
ID=80390653
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111368223.XA Active CN114143291B (en) | 2021-11-18 | 2021-11-18 | HTTP communication method and system based on TCP and UDP |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114143291B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103369152A (en) * | 2012-03-31 | 2013-10-23 | 百度在线网络技术(北京)有限公司 | SIP based method and device for providing called party with caller-related information |
CN110995784A (en) * | 2019-11-05 | 2020-04-10 | 北京奇艺世纪科技有限公司 | Data transmission method, system and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8767719B2 (en) * | 2011-09-23 | 2014-07-01 | Avaya Inc. | System and method for split SIP |
WO2014094798A1 (en) * | 2012-12-19 | 2014-06-26 | Unify Gmbh & Co. Kg | Method of conveying a location information representing a physical location of a first communication device, a computer program product for executing the method, and the first communication device for conveying the location information |
CN104159165A (en) * | 2014-07-26 | 2014-11-19 | 佳都新太科技股份有限公司 | Method capable of transmitting RTP (real-time transport protocol) media stream through TCP (transmission control protocol) and based on SIP (session initiation protocol) |
CN106452689A (en) * | 2016-11-28 | 2017-02-22 | 畅捷通信息技术股份有限公司 | Data transmission apparatus and method of client and data transmission apparatus and method of server |
CN112804338A (en) * | 2021-01-25 | 2021-05-14 | 浙江工业大学 | Method for remote communication between Web front end and Internet of things equipment |
-
2021
- 2021-11-18 CN CN202111368223.XA patent/CN114143291B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103369152A (en) * | 2012-03-31 | 2013-10-23 | 百度在线网络技术(北京)有限公司 | SIP based method and device for providing called party with caller-related information |
CN110995784A (en) * | 2019-11-05 | 2020-04-10 | 北京奇艺世纪科技有限公司 | Data transmission method, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114143291A (en) | 2022-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Fathi et al. | Optimization of SIP session setup delay for VoIP in 3G wireless networks | |
US7587490B2 (en) | Interception method and system for compensating disadvantageous characteristics of a communication protocol | |
De Caro et al. | Comparison of two lightweight protocols for smartphone-based sensing | |
US8291022B2 (en) | Method and device for messaging | |
US8467308B2 (en) | Communication session quality indicator | |
US7542472B1 (en) | Data transmission | |
US20080120427A1 (en) | Maintaining real-time conversations over unreliable connections | |
KR20050122227A (en) | System and method to provide interoperability between session initiation protocol and other messaging services | |
KR20070015405A (en) | Session initiation protocol retransmission method | |
KR20040061079A (en) | Apparatus and method for session establishment in radio network organized mobile nodes | |
CN102769520A (en) | Wireless network congestion control method based on stream control transmission protocol (SCTP) | |
Fathi et al. | On SIP session setup delay for VoIP services over correlated fading channels | |
US20160261559A1 (en) | Efficient tunneled streams for real-time communications | |
EP1798935A1 (en) | Alarm and messaging communications system having wireless network gateway | |
CN114143291B (en) | HTTP communication method and system based on TCP and UDP | |
US20050021840A1 (en) | Method and an apparatus for enhancing messaging | |
Sisalem et al. | A Theoretical Model of the Effects of Losses and Delays on the Performance of SIP | |
KR100959019B1 (en) | Method for collecting billing information in real time by forking SIP messages in a SIP-based network | |
Fathi et al. | Optimization of VoIP session setup delay over wireless links using SIP | |
Hristov | Signaling Delay in Wireless Networks with Ses-sion Initiation Protocol over User Datagram Pro-tocol | |
KR100929113B1 (en) | Bidirectional resource reservation method using resource reservation protocol | |
KR101962225B1 (en) | Method for Session Initiation Protocol(SIP) in Tactical Wireless Ad-hoc Networks | |
EP1170923B1 (en) | Interception method and system for compensating disadvantageous characteristics of a communication protocol | |
KR20070075708A (en) | Method for processing error in session initiation protocol | |
Moghadam et al. | Scenarios for Testing Reliable Transmission of Provisional Responses in SIP User Agent |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |