Method, device, electronic device and readable storage medium for providing HTTP service

By establishing a TCP socket on the edge sub-device and interacting with the detection keep-alive server to obtain the public network address, the problems of low connection success rate and unstable data transmission of HTTP services under the UDP protocol on edge sub-devices are solved, and more efficient HTTP services are achieved.

CN116582528BActive Publication Date: 2025-10-03BEIJING DUYOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310357720.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-04
Publication Date
2025-10-03
Estimated Expiration
2043-04-04

AI Technical Summary

Technical Problem

When edge devices provide HTTP services based on the UDP protocol, there are problems with low connection success rate and unstable data transmission.

Method used

By establishing TCP sockets in client mode and server mode on the target port, it interacts with the detection keepalive server to obtain the public network address and implement HTTP service.

Benefits of technology

Improved the connection success rate and data transmission stability between edge sub-devices and clients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116582528B_ABST
    Figure CN116582528B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for providing HTTP services. Among them, the method applied to the full-cone edge sub-device includes: sending a registration request to the detection keep-alive server through a TCP socket in client mode established on the target port; after receiving the registration response message sent by the detection keep-alive server through the TCP socket in client mode, establishing a TCP socket in server mode on the target port; after receiving the first keep-alive message sent regularly by the detection keep-alive server through the TCP socket in server mode, extracting the public network address from the first keep-alive message; registering with the HTTP service provided by the full-cone edge sub-device based on the public network address. The method applied to the detection keep-alive server includes: registering the full-cone edge sub-device after receiving the registration request sent by the full-cone edge sub-device; generating a registration response message and sending it to the full-cone edge sub-device; and sending the first keep-alive message to the full-cone edge sub-device regularly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, particularly to artificial intelligence technologies such as cloud data, cloud computing, the Internet of Things, and edge computing. A method, apparatus, electronic device, and readable storage medium for providing HTTP services are provided. Background Art

[0002] In existing technologies, edge devices typically provide HTTP services based on the User Datagram Protocol (UDP). However, this approach can lead to issues such as low connection success rates, unstable data transmission, and the need for special processing on the edge devices. Summary of the Invention

[0003] According to a first aspect of the present disclosure, a method for providing HTTP services is provided, which is applied to a full-cone edge sub-device, comprising: sending a registration request to a detection keep-alive server through a client-mode Transmission Control Protocol TCP socket established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keep-alive server; after receiving a registration response message sent by the detection keep-alive server through the client-mode TCP socket, establishing a server-mode TCP socket on the target port; after receiving a first keep-alive message periodically sent by the detection keep-alive server through the server-mode TCP socket, extracting a public network address from the first keep-alive message; registering with the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

[0004] According to a second aspect of the present disclosure, a method for providing HTTP service is provided, which is applied to detecting a keep-alive server, comprising: registering the full-cone edge sub-device after receiving a registration request sent by a full-cone edge sub-device, the registration request being sent by the full-cone edge sub-device through a client-mode TCP socket established on a target port; generating a registration response message and sending it to the full-cone edge sub-device, the registration response message being used by the full-cone edge sub-device to establish a server-mode TCP socket on the target port; and periodically sending a first keep-alive message to the full-cone edge sub-device, the full-cone edge sub-device receiving the first keep-alive message through the server-mode TCP socket, the first keep-alive message including the public network address of the full-cone edge sub-device.

[0005] According to a third aspect of the present disclosure, there is provided an apparatus for providing HTTP services, which is applied to a full-cone edge sub-device, and includes: a first sending unit, for sending a registration request to a detection keep-alive server through a client-mode Transmission Control Protocol TCP socket established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keep-alive server; an establishing unit, for establishing a server-mode TCP socket on the target port after receiving a registration response message sent by the detection keep-alive server through the client-mode TCP socket; a processing unit, for extracting a public network address from a first keep-alive message periodically sent by the detection keep-alive server after receiving the first keep-alive message through the server-mode TCP socket; and a second registration unit, for registering with the HTTP service provided by the full-cone edge sub-device based on the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

[0006] According to a fourth aspect of the present disclosure, there is provided a device for providing HTTP service, which is applied to detecting a keep-alive server, and includes: a first registration unit, for registering a full-cone edge sub-device after receiving a registration request sent by the full-cone edge sub-device, wherein the registration request is sent by the full-cone edge sub-device through a client-mode TCP socket established on a target port; a second sending unit, for generating a registration response message and sending it to the full-cone edge sub-device, wherein the registration response message is used for the full-cone edge sub-device to establish a server-mode TCP socket on the target port; a fourth sending unit, for periodically sending a first keep-alive message to the full-cone edge sub-device, wherein the full-cone edge sub-device receives the first keep-alive message through the server-mode TCP socket, and the first keep-alive message includes the public network address of the full-cone edge sub-device.

[0007] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described above.

[0008] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method as described above.

[0009] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the method described above when executed by a processor.

[0010] It can be seen from the above technical solutions that the full-cone edge sub-device in the present disclosure adopts the method of establishing a TCP socket in client mode and a TCP socket in server mode on a target port respectively, so as to achieve the purpose of obtaining its own public network address by detecting the keep-alive server and then providing HTTP service, and the full-cone edge sub-device connects to the client and transmits data based on the TCP protocol, thereby improving the success rate of establishing a connection between the full-cone edge sub-device and the client, and enhancing the stability of data transmission between the full-cone edge sub-device and the client.

[0011] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0013] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0014] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0015] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;

[0016] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0017] Figure 5 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0018] Figure 6 is a schematic diagram according to a sixth embodiment of the present disclosure;

[0019] Figure 7 It is a block diagram of an electronic device used to implement the method for providing HTTP service according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, and various details of the embodiments of the present disclosure are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and mechanisms are omitted in the following description.

[0021] Figure 1 Schematic diagram of the first embodiment of the present disclosure. Figure 1 As shown, the method for providing HTTP services in this embodiment is applied to a full-cone edge sub-device and specifically includes the following steps:

[0022] S101. Sending a registration request to a detection keepalive server through a Transmission Control Protocol (TCP) socket in client mode established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keepalive server;

[0023] S102: After receiving the registration response message sent by the detection keep-alive server through the TCP socket in the client mode, establish a TCP socket in the server mode on the target port;

[0024] S103: After receiving a first keep-alive message regularly sent by the detection keep-alive server through the TCP socket in the server mode, extracting a public network address from the first keep-alive message;

[0025] S104: Register the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

[0026] The executor of the method for providing HTTP service in this embodiment is a full cone edge sub-device. The full cone edge sub-device adopts the method of establishing a TCP socket in client mode and a TCP socket in server mode on a target port respectively, so as to achieve the purpose of obtaining its own public network address by detecting the keep-alive server and then providing HTTP service. The full cone edge sub-device connects to the client and transmits data based on the TCP protocol, thereby improving the success rate of establishing a connection between the full cone edge sub-device and the client and enhancing the stability of data transmission between the full cone edge sub-device and the client.

[0027] The full-cone edge sub-device in this embodiment may also be referred to as a NAT1 edge sub-device, which is one of four NAT (Network Address Translation) types. The full-cone edge sub-device in this embodiment may be a server from a third-party manufacturer.

[0028] In this embodiment, the full-cone edge sub-device executes S101 to send a registration request to the detection keep-alive server, which may also include identification information of the full-cone edge sub-device. The identification information may be a device ID, a device name, and the like.

[0029] Therefore, the detection keep-alive server of this embodiment registers the full-cone edge sub-device, that is, the detection keep-alive server records the correspondence between different edge sub-devices and different identification information.

[0030] When the full-cone edge sub-device of this embodiment executes S101 to send a registration request to the detection keep-alive server through the client mode TCP socket, it can first send the registration request to the edge master device (such as an edge gateway, edge router, etc.) through the client mode TCP socket established on the target port, and then the edge master device forwards the registration request to the detection keep-alive server; wherein, the edge master device is connected to at least one edge sub-device, and the edge master device can determine the public network address of each edge sub-device connected to it.

[0031] In this embodiment, when the edge master device forwards the registration request sent by the full-cone edge sub-device to the detection keep-alive server, it can also determine the public network address of the full-cone edge sub-device, add the public network address to the registration request, and then send the registration request to the detection keep-alive server.

[0032] After executing S101, the full-cone edge sub-device of this embodiment sends a registration request to the detection keep-alive server through the client mode TCP socket established on the target port, and executes S102, after receiving the registration response message sent by the detection keep-alive server through the client mode TCP socket, to establish a server mode TCP socket on the target port.

[0033] When the full-cone edge sub-device of this embodiment executes S102, if it receives a registration response message sent by the detection keep-alive server, it indicates that the detection keep-alive server has completed the registration of the full-cone edge sub-device; if the full-cone edge sub-device does not receive a registration response message within a period of time, it indicates that the registration is unsuccessful, and it can send a registration request to the detection keep-alive server again, and repeat this cycle until it receives a registration response message or the number of registration requests sent reaches a preset number.

[0034] When executing S102, the full-cone edge sub-device of this embodiment can receive the registration response message forwarded by the edge master device through the client mode TCP socket established on the target port; and the registration response message forwarded by the edge master device is sent to the edge master device after the detection keep-alive server completes the registration of the full-cone edge sub-device. The detection keep-alive server can add the public network address of the full-cone edge sub-device to the registration response message, so that the edge master device can accurately forward the registration response message according to the public network address in the registration response message.

[0035] After executing S102 and receiving the registration response message, the full-cone edge sub-device of this embodiment establishes a server mode TCP socket on the target port of the client mode TCP socket; the server mode TCP socket can communicate directly with the detection keep-alive server or client without going through the edge main device.

[0036] After executing S102 and receiving the registration response message sent by the detection keep-alive server, the full-cone edge sub-device of this embodiment may further execute the following: closing the client mode TCP socket established on the target port.

[0037] After executing S102 to establish a TCP socket in server mode on the target port, the full-cone edge sub-device of this embodiment executes S103 to extract the public network address from the first keep-alive message after receiving the first keep-alive message sent periodically by the detection keep-alive server through the TCP socket in server mode.

[0038] That is to say, the detection keep-alive server of this embodiment will continuously send the first keep-alive message to the full-cone edge sub-device at a certain time interval. If the full-cone edge sub-device can receive the first keep-alive message, it indicates that the full-cone edge sub-device can be accessed through TCP or HTTP, that is, it can provide HTTP service; if the full-cone edge sub-device does not receive the first keep-alive message, it indicates that the full-cone edge sub-device cannot provide HTTP service.

[0039] After executing S103 to extract the public network address from the first keep-alive message, the full-cone edge sub-device of this embodiment executes S104 to register with the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client can access the full-cone edge sub-device through the public network address to use the HTTP service.

[0040] The HTTP service in this embodiment is a service based on HTTP requests, such as a network disk service, a web page service, etc. Data can be stored and downloaded through the network disk service, and web pages can be browsed through the web page service.

[0041] When the full-cone edge sub-device of this embodiment executes S104 to register according to the public network address and the HTTP service provided by the full-cone edge sub-device, it can register in the domain name server or the address server, so that the correspondence between the public network address of the full-cone edge sub-device and the HTTP service provided by the full-cone edge sub-device is recorded in the domain name server or the address server.

[0042] After completing the registration of the public network address and HTTP service of the full-cone edge sub-device, the relevant client can query in the domain name server or address server according to the HTTP service to be used, and then access the corresponding full-cone edge sub-device according to the public network address obtained by the query. Specifically, it communicates with the TCP socket of the server mode of the full-cone edge sub-device based on the public network address, so as to perform related operations such as data storage or downloading, or browsing web pages.

[0043] Figure 2 Schematic diagram of the second embodiment of the present disclosure. Figure 2 As shown in , the method for providing HTTP services in this embodiment may further include the following contents:

[0044] S201, detecting whether the TCP socket in the client mode is closed;

[0045] S202. When it is determined that the TCP socket in the client mode is not closed, a second keep-alive message is periodically sent to the detection keep-alive server through the TCP socket in the client mode, so that the detection keep-alive server can register with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device after receiving the second keep-alive message periodically sent by the full-cone edge sub-device.

[0046] That is to say, the full-cone edge sub-device of this embodiment can also continuously send a second keep-alive message to the detection keep-alive server through the TCP socket at a certain time interval without closing the TCP socket in client mode, so that the detection keep-alive server can know that the full-cone edge sub-device is in a survival state, and then the detection keep-alive server executes the registration of the public network address and its corresponding HTTP service, which can improve registration efficiency.

[0047] When the full-cone edge sub-device of this embodiment executes S202 to periodically send the second keep-alive message to the detection keep-alive server through the TCP socket in client mode, it can first send the second keep-alive message to the edge master device through the TCP socket in client mode, and then the edge master device forwards the second keep-alive message to the detection keep-alive server.

[0048] Figure 3 Schematic diagram of the third embodiment of the present disclosure. Figure 3 As shown, the method for providing HTTP service in this embodiment is applied to detect a keep-alive server and specifically includes the following steps:

[0049] S301: After receiving a registration request sent by a Full Cone Edge sub-device, register the Full Cone Edge sub-device, where the registration request is sent by the Full Cone Edge sub-device through a TCP socket in client mode established on a target port;

[0050] S302: Generate a registration response message and send it to the Full-Cone Edge sub-device, where the registration response message is used by the Full-Cone Edge sub-device to establish a TCP socket in server mode on a target port.

[0051] S303: Periodically send a first keep-alive message to the full-cone edge sub-device, and the full-cone edge sub-device receives the first keep-alive message through the TCP socket in server mode, wherein the first keep-alive message includes the public network address corresponding to the full-cone edge sub-device.

[0052] The execution body of the method for providing HTTP service in this embodiment is located in the detection keep-alive server, which can support the reception and sending of TCP protocol messages. Through the interaction between the detection keep-alive server and the full-cone edge sub-device, the full-cone edge sub-device can obtain the public network address and then provide HTTP service.

[0053] When executing S301, the detection keep-alive server of this embodiment can obtain a registration request forwarded by the edge master device corresponding to the full-cone edge sub-device, and the registration request includes the identification information of the full-cone edge sub-device; when registering the full-cone edge sub-device, the detection keep-alive server of this embodiment specifically records the correspondence between the full-cone edge sub-device and the identification information.

[0054] After executing S301 to register the full-cone edge sub-device, the detection keep-alive server of this embodiment can also extract the public network address corresponding to the full-cone edge sub-device from the registration request. The public network address is added when the edge master device corresponding to the full-cone edge sub-device forwards the registration request to the detection keep-alive server.

[0055] After executing S301 to register the full-cone edge sub-device, the detection keep-alive server of this embodiment executes S302 to generate a registration response message and sends it to the full-cone edge sub-device.

[0056] It is understandable that, when executing S302 to generate the registration response message, the detection keep-alive server of this embodiment may also obtain the public network address corresponding to the full-cone edge sub-device, and then add the public network address to the registration response message.

[0057] When executing S302 to send the registration response message to the full-cone edge sub-device, the detection keep-alive server of this embodiment can first send the registration response message to the edge master device, and then the edge master device forwards the registration response message to the full-cone edge sub-device through the TCP socket in client mode.

[0058] After executing S302 to generate a registration response message and send it to the full-cone edge sub-device, the detection keep-alive server of this embodiment executes S303 to periodically send a first keep-alive message to the full-cone edge sub-device.

[0059] When executing S303 to periodically send the first keep-alive message to the full-cone edge sub-device, the detection keep-alive server of this embodiment can periodically send the first keep-alive message to the full-cone edge sub-device according to the public network address corresponding to the full-cone edge sub-device; wherein the first keep-alive message includes the public network address of the full-cone edge sub-device.

[0060] After executing S303 to periodically send the first keep-alive message to the full-cone edge sub-device, the detection keep-alive server of this embodiment may also include the following content: after receiving the second keep-alive message periodically sent by the full-cone edge sub-device, register with the HTTP service provided by the full-cone edge sub-device according to the public network address.

[0061] The second keep-alive message received by the detection keep-alive server of this embodiment is sent by the full-cone edge sub-device through the TCP socket in client mode; similarly, the detection keep-alive server can obtain the second keep-alive message forwarded by the edge master device.

[0062] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure. Figure 4FIG4 shows an interaction diagram between the full-cone edge sub-device, the detection keep-alive server, the domain name or address server, and the client when providing HTTP service in this embodiment: S401, the full-cone edge sub-device establishes a TCP socket in client mode on the target port; S402, the full-cone edge sub-device sends a registration request to the registration keep-alive server through the TCP socket in client mode; S403, the detection keep-alive server registers the full-cone edge sub-device according to the registration request, and records the public network address of the full-cone edge sub-device; S404, the detection keep-alive server sends a registration response message to the full-cone edge sub-device, and the full-cone edge sub-device receives the registration response message through the TCP socket in client mode; S405, after receiving the registration response message, the full-cone edge sub-device closes the TCP socket in client mode and establishes a TCP socket in server mode on the target port; S406 6. The detection keep-alive server periodically sends the first keep-alive message to the full-cone edge sub-device, and the first keep-alive message includes the public network address corresponding to the full-cone edge sub-device; S407. After receiving the first keep-alive message sent by the detection keep-alive server through the TCP socket in server mode, the full-cone edge sub-device extracts the public network address from the first keep-alive message; S408. The full-cone edge sub-device registers in the domain name or address server according to the public network address and the HTTP service it provides; S409. The domain name or address server records the correspondence between the public network address of the full-cone edge sub-device and the HTTP service it provides; S410. The client accesses the domain name or address server to query the public network address corresponding to the HTTP service it needs; S411. The client accesses the full-cone edge sub-device according to the public network address obtained from the query to use the HTTP service provided by the full-cone edge sub-device.

[0063] Figure 5 Schematic diagram of the fifth embodiment of the present disclosure. Figure 5 As shown, the apparatus 500 for providing HTTP services in this embodiment is applied to a full-cone edge sub-device, including:

[0064] The first sending unit 501 is configured to send a registration request to a detection keepalive server through a Transmission Control Protocol TCP socket in client mode established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keepalive server;

[0065] An establishing unit 502 is configured to establish a TCP socket in server mode on the target port after receiving a registration response message sent by the detection keep-alive server through the TCP socket in client mode;

[0066] The processing unit 503 is configured to extract a public network address from a first keep-alive message sent periodically by the detection keep-alive server after receiving the first keep-alive message through the TCP socket in the server mode;

[0067] The second registration unit 504 is configured to register the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

[0068] The registration request sent by the first sending unit 501 to the detection keep-alive server may further include identification information of the full-cone edge sub-device, and the identification information may be a device ID, a device name, and the like.

[0069] Therefore, the detection keep-alive server of this embodiment registers the full-cone edge sub-device, that is, the detection keep-alive server records the correspondence between different edge sub-devices and different identification information.

[0070] When the first sending unit 501 sends a registration request to the detection keep-alive server through a TCP socket in client mode, the registration request can be first sent to an edge master device (such as an edge gateway, edge router, etc.) through a TCP socket in client mode established on the target port, and then the edge master device forwards the registration request to the detection keep-alive server; wherein, the edge master device is connected to at least one edge sub-device, and the edge master device can determine the public network address of each edge sub-device connected to it.

[0071] In this embodiment, when the edge master device forwards the registration request sent by the full-cone edge sub-device to the detection keep-alive server, it can also determine the public network address of the full-cone edge sub-device, add the public network address to the registration request, and then send the registration request to the detection keep-alive server.

[0072] In this embodiment, after the first sending unit 501 sends a registration request to the detection keep-alive server through the client mode TCP socket established on the target port, the establishing unit 502 establishes a server mode TCP socket on the target port after receiving the registration response message sent by the detection keep-alive server through the client mode TCP socket.

[0073] If the establishment unit 502 receives a registration response message sent by the detection keep-alive server, it indicates that the detection keep-alive server has completed the registration of the full-cone edge sub-device; if the full-cone edge sub-device does not receive a registration response message within a period of time, it indicates that the registration is unsuccessful, and it can send a registration request to the detection keep-alive server again, and repeat this cycle until the registration response message is received or the number of registration requests sent reaches the preset number.

[0074] The establishment unit 502 can receive the registration response message forwarded by the edge master device through the client mode TCP socket established on the target port; and the registration response message forwarded by the edge master device is sent to the edge master device after the detection keep-alive server completes the registration of the full-cone edge sub-device. The detection keep-alive server can add the public network address of the full-cone edge sub-device to the registration response message, so that the edge master device can accurately forward the registration response message according to the public network address in the registration response message.

[0075] After receiving the registration response message, the establishment unit 502 establishes a server mode TCP socket on the target port of the client mode TCP socket; the server mode TCP socket can communicate directly with the detection keep-alive server or client without going through the edge master device.

[0076] After receiving the registration response message sent by the detection keep-alive server, the establishing unit 502 may further execute the following: closing the TCP socket in client mode established on the target port.

[0077] After the establishment unit 502 establishes a server mode TCP socket on the target port, the processing unit 503 of the full-cone edge sub-device of this embodiment extracts the public network address from the first keep-alive message after receiving the first keep-alive message sent periodically by the detection keep-alive server through the server mode TCP socket.

[0078] That is to say, the detection keep-alive server of this embodiment will continuously send the first keep-alive message to the full-cone edge sub-device at a certain time interval. If the full-cone edge sub-device can receive the first keep-alive message, it indicates that the full-cone edge sub-device can be accessed through TCP or HTTP, that is, it can provide HTTP service; if the full-cone edge sub-device does not receive the first keep-alive message, it indicates that the full-cone edge sub-device cannot provide HTTP service.

[0079] After the processing unit 503 extracts the public network address from the first keep-alive message, the second registration unit 504 registers the full-cone edge sub-device according to the public network address and the HTTP service provided by the full-cone edge sub-device in this embodiment, so that the client can access the full-cone edge sub-device through the public network address to use the HTTP service.

[0080] The HTTP service in this embodiment is a service based on HTTP requests, such as a network disk service, a web page service, etc. Data can be stored and downloaded through the network disk service, and web pages can be browsed through the web page service.

[0081] When registering based on the public network address and the HTTP service provided by the full-cone edge sub-device, the second registration unit 504 can be registered in the domain name server or the address server, so that the correspondence between the public network address of the full-cone edge sub-device and the HTTP service provided by the full-cone edge sub-device is recorded in the domain name server or the address server.

[0082] After completing the registration of the public network address and HTTP service of the full-cone edge sub-device, the relevant client can query the domain name server or address server according to the HTTP service to be used, and then access the corresponding full-cone edge sub-device according to the public network address obtained from the query to perform related operations such as data storage or downloading, or web browsing.

[0083] The device 500 for providing HTTP service in this embodiment may also include a third sending unit 505, which is used to perform the following contents: detecting whether the TCP socket in client mode is closed; when it is determined that the TCP socket in client mode is not closed, periodically sending a second keep-alive message to the detection keep-alive server through the TCP socket in client mode, so that after the detection keep-alive server receives the second keep-alive message periodically sent by the full-cone edge sub-device, it registers with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device.

[0084] That is to say, the third sending unit 505 can also continuously send the second keep-alive message to the detection keep-alive server through the TCP socket at a certain time interval without closing the TCP socket in client mode, so that the detection keep-alive server can know that the full-cone edge sub-device is in a survival state, and then the detection keep-alive server executes the registration of the public network address and its corresponding HTTP service, which can improve the registration efficiency.

[0085] When the third sending unit 505 periodically sends the second keep-alive message to the detection keep-alive server through the TCP socket in client mode, it can first send the second keep-alive message to the edge master device through the TCP socket in client mode, and then the edge master device forwards the second keep-alive message to the detection keep-alive server.

[0086] Figure 6 Schematic diagram of the sixth embodiment of the present disclosure. Figure 6 As shown, the apparatus 600 for providing HTTP service in this embodiment is applied to detect a keep-alive server, and includes:

[0087] A first registration unit 601 is configured to register the full-cone edge sub-device after receiving a registration request sent by the full-cone edge sub-device, wherein the registration request is sent by the full-cone edge sub-device through a TCP socket in client mode established on a target port;

[0088] The second sending unit 602 is configured to generate a registration response message and send it to the Full Cone Edge sub-device, where the registration response message is used by the Full Cone Edge sub-device to establish a TCP socket in server mode on a target port.

[0089] The fourth sending unit 603 is used to periodically send a first keep-alive message to the full-cone edge sub-device, and the full-cone edge sub-device receives the first keep-alive message through the TCP socket in the server mode. The first keep-alive message includes the public network address corresponding to the full-cone edge sub-device.

[0090] The first registration unit 601 can obtain a registration request forwarded by the edge master device corresponding to the full-cone edge sub-device, and the registration request includes the identification information of the full-cone edge sub-device; when the detection keep-alive server of this embodiment registers the full-cone edge sub-device, it specifically records the correspondence between the full-cone edge sub-device and the identification information.

[0091] After registering the full-cone edge sub-device, the first registration unit 601 can also extract the public network address corresponding to the full-cone edge sub-device from the registration request. The public network address is added when the edge master device corresponding to the full-cone edge sub-device forwards the registration request to the detection keep-alive server.

[0092] In this embodiment, after the first registration unit 601 registers the full-cone edge sub-device, the second sending unit 602 of the detection keep-alive server generates a registration response message and sends it to the full-cone edge sub-device.

[0093] It is understandable that, when generating the registration response message, the second sending unit 602 may further obtain the public network address corresponding to the full-cone edge sub-device, and then add the public network address to the registration response message.

[0094] In this embodiment, after the second sending unit 602 of the detection keepalive server generates a registration response message and sends it to the full-cone edge sub-device, the fourth sending unit 603 periodically sends a first keepalive message to the full-cone edge sub-device.

[0095] When the fourth sending unit 603 sends the first keep-alive message to the full-cone edge sub-device at regular intervals, it can send the first keep-alive message to the full-cone edge sub-device at regular intervals according to the public network address corresponding to the full-cone edge sub-device; wherein the first keep-alive message includes the public network address of the full-cone edge sub-device.

[0096] The apparatus 600 for providing HTTP services in this embodiment may further include a third registration unit 604 for performing the following operations: after receiving the second keep-alive message sent periodically by the full-cone edge sub-device, registering with the HTTP service provided by the full-cone edge sub-device according to the public network address.

[0097] The second keep-alive message received by the third registration unit 604 is sent by the full-cone edge sub-device through the TCP socket in client mode; similarly, the detection keep-alive server can obtain the second keep-alive message forwarded by the edge master device.

[0098] In the technical solutions disclosed herein, the acquisition, storage, and application of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0099] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0100] like Figure 7 , is a block diagram of an electronic device for providing a method for HTTP service according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0101] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0102] Various components in device 700 are connected to I / O interface 705, including: an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0103] The computing unit 701 may be a variety of general and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a method for providing an HTTP service. For example, in some embodiments, the method for providing an HTTP service may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 708.

[0104] In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the method for providing HTTP services described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the method for providing HTTP services in any other appropriate manner (e.g., by means of firmware).

[0105] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0106] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable device that provides HTTP services, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0107] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0109] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0110] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. The client-server relationship is established by computer programs running on the respective computers and establishing a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service system that addresses the management difficulties and poor business scalability of traditional physical hosts and VPS services ("Virtual Private Servers," or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.

[0111] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.

[0112] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A method for providing HTTP services, applied to a full-cone edge sub-device, comprising: Sending a registration request to a detection keepalive server through a Transmission Control Protocol (TCP) socket in client mode established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keepalive server; After receiving the registration response message sent by the detection keep-alive server through the TCP socket in the client mode, establishing a TCP socket in the server mode on the target port; After receiving a first keep-alive message regularly sent by the detection keep-alive server through the TCP socket in the server mode, extracting a public network address from the first keep-alive message; Register with the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

2. The method according to claim 1, wherein The sending of a registration request to the detection keep-alive server through a Transmission Control Protocol (TCP) socket in client mode established on the target port includes: The registration request is sent to the edge master device through the TCP socket in the client mode, so that the edge master device forwards the registration request to the detection keep-alive server.

3. The method according to claim 1, further comprising: After receiving the registration response message sent by the detection keep-alive server through the TCP socket in the client mode, the TCP socket in the client mode is closed.

4. The method according to claim 1, further comprising: Detect whether the TCP socket in client mode is closed; When it is determined that the TCP socket in the client mode is not closed, a second keep-alive message is periodically sent to the detection keep-alive server through the TCP socket in the client mode, so that the detection keep-alive server can register with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device after receiving the second keep-alive message periodically sent by the full-cone edge sub-device.

5. The method according to claim 4, wherein The sending of the second keep-alive message to the detection keep-alive server periodically through the TCP socket in the client mode includes: The second keep-alive message is periodically sent to the edge master device through the TCP socket in the client mode, so that the edge master device forwards the second keep-alive message to the detection keep-alive server.

6. A method for providing HTTP services, applied to detecting a keep-alive server, comprising: registering the Full Cone Edge sub-device after receiving a registration request sent by the Full Cone Edge sub-device through a TCP socket in client mode established on a target port; Generate a registration response message and send it to the full-cone edge sub-device, where the registration response message is used by the full-cone edge sub-device to establish a TCP socket in server mode on a target port; Periodically sending a first keep-alive message to the full-cone edge sub-device, wherein the full-cone edge sub-device receives the first keep-alive message through the TCP socket in the server mode, wherein the first keep-alive message includes the public network address of the full-cone edge sub-device; The full-cone edge sub-device executes the method according to any one of claims 1 to 5.

7. The method according to claim 6, further comprising: After receiving the second keep-alive message regularly sent by the full-cone edge sub-device, register with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device.

8. An apparatus for providing HTTP services, applied to a full-cone edge sub-device, comprising: A first sending unit is configured to send a registration request to a detection keepalive server through a Transmission Control Protocol TCP socket in client mode established on a target port, wherein the registration request is used to register the full-cone edge sub-device in the detection keepalive server; An establishing unit, configured to establish a TCP socket in server mode on the target port after receiving a registration response message sent by the detection keep-alive server through the TCP socket in client mode; a processing unit, configured to extract a public network address from a first keep-alive message periodically sent by the detection keep-alive server after receiving the first keep-alive message through the TCP socket in the server mode; The second registration unit is configured to register the HTTP service provided by the full-cone edge sub-device according to the public network address, so that the client accesses the full-cone edge sub-device through the public network address to use the HTTP service.

9. The device according to claim 8, wherein When the first sending unit sends a registration request to the detection keep-alive server through a Transmission Control Protocol TCP socket in client mode established on the target port, the first sending unit specifically performs: The registration request is sent to the edge master device through the TCP socket in the client mode, so that the edge master device forwards the registration request to the detection keep-alive server.

10. The device according to claim 8, wherein The establishing unit is further configured to execute: After receiving the registration response message sent by the detection keep-alive server through the TCP socket in the client mode, the TCP socket in the client mode is closed.

11. The apparatus according to claim 8, further comprising a third sending unit, configured to execute: Detect whether the TCP socket in client mode is closed; When it is determined that the TCP socket in the client mode is not closed, a second keep-alive message is periodically sent to the detection keep-alive server through the TCP socket in the client mode, so that the detection keep-alive server can register with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device after receiving the second keep-alive message periodically sent by the full-cone edge sub-device.

12. The device according to claim 11, wherein When the third sending unit periodically sends the second keep-alive message to the detection keep-alive server through the TCP socket in the client mode, the third sending unit specifically performs: The second keep-alive message is periodically sent to the edge master device through the TCP socket in the client mode, so that the edge master device forwards the second keep-alive message to the detection keep-alive server.

13. A device for providing HTTP services, used for detecting a keep-alive server, comprising: a first registration unit, configured to register the full-cone edge sub-device after receiving a registration request sent by the full-cone edge sub-device, wherein the registration request is sent by the full-cone edge sub-device through a TCP socket in client mode established on a target port; A second sending unit is configured to generate a registration response message and send the message to the full-cone edge sub-device, wherein the registration response message is used by the full-cone edge sub-device to establish a TCP socket in server mode on a target port; a fourth sending unit, configured to periodically send a first keep-alive message to the full-cone edge sub-device, wherein the full-cone edge sub-device receives the first keep-alive message through the TCP socket in the server mode, wherein the first keep-alive message includes a public network address of the full-cone edge sub-device; Wherein, the full-cone edge sub-device includes the device described in any one of claims 8-12.

14. The apparatus according to claim 13, further comprising a third registration unit, configured to execute: After receiving the second keep-alive message regularly sent by the full-cone edge sub-device, register with the HTTP service provided by the full-cone edge sub-device according to the public network address of the full-cone edge sub-device.

15. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.

17. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and system for penetrating NAT to establish overlay network in P2P network

    CN101741914A

  • NAT crossing method and system for TCP, third-party server X and client

    CN104427008A