A system, a method of accessing a NAS device, a NAS device, and an electronic device

CN117811873BActive Publication Date: 2026-10-23HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211168757.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-24
Publication Date
2026-10-23
Estimated Expiration
2042-09-24

AI Technical Summary

Technical Problem

电子设备开启VPN服务时,需要用户手动授权且每一个电子设备一次只能开启一个VPN服务,上述操作步骤不仅繁琐而且可能影响用户使用其他的VPN服务,从而带来的用户体验不佳

Benefits of technology

[0039]其中,第四方面至第十方面的有益效果,请参见第一方面至第三方面的有益效果,不重复赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117811873B_ABST
    Figure CN117811873B_ABST
Patent Text Reader

Abstract

The application provides a system, a method for accessing a NAS device, the NAS device, and an electronic device. The NAS device receives a first packet sent by the electronic device, and establishes a TCP proxy with the electronic device. The first packet is a TCP proxy server of the electronic device, a port of the TCP proxy server corresponds to a first port of a virtual server in the NAS device, and the first packet comprises a TCP proxy header and a payload. After receiving the first packet, the NAS device sends the payload to the first port of the virtual server in the NAS device according to the first packet, so that the virtual server in the NAS device sends the payload to an application service corresponding to the payload. By creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely access or access the NAS device in a short range. The electronic device can remotely access the NAS device without starting a VPN service, and the creation of the VPN service does not affect other services of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and more specifically, to a system, a method for accessing a NAS device, a NAS device, and an electronic device. Background Technology

[0002] With technological advancements and the increasing prevalence of electronic devices, users are accumulating more and more personal data, leading to a growing demand for storage devices. Storage devices include Network Attached Storage (NAS) devices. Electronic devices can access NAS devices locally when they are on the same local area network (LAN) as the NAS device, or remotely when they are on a different LAN. Currently, remote access to NAS devices requires communication via a peer-to-peer (P2P) network channel and the establishment of a Virtual Private Network (VPN) service. Enabling a VPN service on an electronic device requires manual authorization from the user, and each electronic device can only enable one VPN service at a time. These steps are not only cumbersome but may also interfere with the use of other VPN services, resulting in a poor user experience. Summary of the Invention

[0003] This application provides a system, a method for accessing a NAS device, a NAS device, and an electronic device. By creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling a VPN service, and the VPN service creation does not affect other services of the electronic device.

[0004] A first aspect provides a method for accessing a NAS device. The method, applied to the NAS device, includes: receiving a first message sent by a first electronic device, wherein the NAS device and the first electronic device have established a Transmission Control Protocol (TCP) proxy, the first message is generated and sent by a first TCP proxy server of the first electronic device according to a first request, the first request being sent by a first application of the first electronic device to the first TCP proxy server, the port of the first TCP proxy server corresponding to a first port of a virtual server in the NAS device, the first message including a first TCP proxy header and a first payload, the first TCP proxy header including a first type field and a first index field, the first type field indicating the type of the first message, and the first index field indicating the connection between the first application and the first TCP proxy server; and sending the first payload to the first port of the virtual server in the NAS device according to the first message, so that the virtual server in the NAS device sends the first payload to the application service corresponding to the first payload.

[0005] In this embodiment, by creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling the VPN service, and it does not affect the creation of VPN services for other services of the electronic device.

[0006] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: receiving a second message sent by the first electronic device, the second message being generated and sent by the first TCP proxy server according to a second request, the second request being sent by the first application to the first TCP proxy server, the second message including a second TCP proxy header and a second payload, the second TCP proxy header including a second type field and a second index field, the second type field indicating the type of the second message, and the second index field indicating the connection between the first application and the first TCP proxy server; and sending the second payload to a first port of a virtual server in the NAS device according to the second message, so that the virtual server in the NAS device sends the second payload to the application service corresponding to the second payload.

[0007] In conjunction with the first aspect, in some implementations of the first aspect, the first electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The method further includes: receiving a third message sent by the first electronic device, the third message being generated and sent by the second TCP proxy server according to a third request, the third request being sent by the first application to the second TCP proxy server, the third message including a third TCP proxy header and a third payload, the third TCP proxy header including a third type field and a third index field, the third type field indicating the type of the third message, and the third index field indicating the connection between the first application and the second TCP proxy server; and sending the third payload to the second port of the virtual server in the NAS device according to the third message so that the virtual server in the NAS device sends the third payload to the application service corresponding to the third payload.

[0008] In conjunction with the first aspect, in some implementations of the first aspect, the first electronic device further includes a second application, and the method further includes: receiving a fourth message sent by the first electronic device, the fourth message being generated and sent by the first TCP proxy server according to a fourth request, the fourth request being sent by the second application to the first TCP proxy server, the fourth message including a fourth TCP proxy header and a fourth payload, the fourth TCP proxy header including a fourth type field and a fourth index field, the fourth type field being used to indicate the type of the fourth message, and the fourth index field being used to indicate the connection between the second application and the first TCP proxy server; and sending the fourth payload to a first port of a virtual server in the NAS device according to the fourth message, so that the virtual server in the NAS device sends the fourth payload to the application service corresponding to the fourth payload.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, the first electronic device further includes a second TCP proxy server, which corresponds to a second port of the virtual server in the NAS device. The method further includes: receiving a fifth message sent by the first electronic device, the fifth message being generated and sent by the second TCP proxy server according to a fifth request, the fifth request being sent by the second application to the second TCP proxy server, the fifth message including a fifth TCP proxy header and a fifth payload, the fifth TCP proxy header including a fifth type field and a fifth index field, the fifth type field indicating the type of the fifth message, and the fifth index field indicating the connection between the second application and the second TCP proxy server; and sending the fifth payload to the second port of the virtual server in the NAS device according to the fifth message so that the virtual server in the NAS device sends the fifth payload to the application service corresponding to the fifth payload.

[0010] In conjunction with the first aspect, in some implementations of the first aspect, the first TCP proxy header further includes a first session field, which is used to indicate the session identifier between the first electronic device and the NAS device. The method further includes: receiving a sixth message sent by a second electronic device, wherein the NAS device and the second electronic device have established a TCP proxy, the sixth message is generated and sent by a third TCP proxy server of the second electronic device according to a sixth request, the sixth request is sent by a third application of the second electronic device to the third TCP proxy server, the port of the third TCP proxy server corresponds to the third port of the virtual server in the NAS device, the sixth message includes a sixth TCP proxy header and a sixth payload, the sixth TCP proxy header includes a sixth type field, a sixth index field and a second session field, the sixth type field is used to indicate the type of the sixth message, and the sixth index field is used to indicate the connection between the third application and the third TCP proxy server; sending the sixth payload to the third port of the virtual server in the NAS device according to the sixth message so that the virtual server in the NAS device sends the sixth payload to the application service corresponding to the sixth payload.

[0011] In this embodiment, by adding a session field to the TCP proxy header, the NAS device can determine the source of the received packet based on the session field. Since the NAS device can determine the source of the packet through the session field, it can receive packets from multiple electronic devices.

[0012] In conjunction with the first aspect, in some implementations of the first aspect, the first TCP proxy header also includes a first length field, which is used to indicate the length of the first payload.

[0013] A second aspect provides a system comprising a first electronic device and a network attached storage (NAS) device. The first electronic device and the NAS device establish a TCP proxy. The first electronic device includes a first TCP proxy server and a first application. The port of the first TCP proxy server corresponds to a first port of a virtual server in the NAS device. The first application is used to send a first request to the first TCP proxy server. The first TCP proxy server is used to generate a first message based on the first request. The first message includes a first TCP proxy header and a first payload. The first TCP proxy header includes a first type field and a first index field. The first type field indicates the type of the first message, and the first index field indicates the connection between the first application and the first TCP proxy server. The first TCP proxy server is also used to send the first message to the NAS device. The NAS device is used to send the first payload to the first port of the virtual server in the NAS device, so that the virtual server in the NAS device sends the first payload to the application service corresponding to the first payload.

[0014] In this embodiment, by creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling the VPN service, and it does not affect the creation of VPN services for other services of the electronic device.

[0015] In conjunction with the second aspect, in some implementations of the second aspect, the first application is further configured to send a second request to the first TCP proxy server; the first TCP proxy server is further configured to generate a second message based on the second request, the second message including a second TCP proxy header and a second payload, the second TCP proxy header including a second type field and a second index field, the second type field indicating the type of the second message, and the second index field indicating the connection between the first application and the first TCP proxy server; the first TCP proxy server is further configured to send the second message to the NAS device; the NAS device is further configured to send the second payload to a first port of a virtual server in the NAS device based on the second message, so that the virtual server in the NAS device sends the second payload to the application service corresponding to the second payload.

[0016] In conjunction with the second aspect, in some implementations of the second aspect, the first electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The first application is further configured to send the third request to the second TCP proxy server. The second TCP proxy server is configured to generate a third message based on the third request. The third message includes a third TCP proxy header and a third payload. The third TCP proxy header includes a third type field and a third index field. The third type field indicates the type of the third message, and the third index field indicates the connection between the first application and the second TCP proxy server. The second TCP proxy server is further configured to send the third message to the NAS device. The NAS device is further configured to send the third payload to the second port of the virtual server in the NAS device based on the third message, so that the virtual server in the NAS device sends the third payload to the application service corresponding to the third payload.

[0017] In conjunction with the second aspect, in some implementations of the second aspect, the first electronic device further includes a second application, wherein the second application is configured to send a fourth request to the first TCP proxy server; the first TCP proxy server is further configured to generate a fourth message based on the fourth request, the fourth message including a fourth TCP proxy header and a fourth payload, the fourth TCP proxy header including a fourth type field and a fourth index field, the fourth type field indicating the type of the fourth message, and the fourth index field indicating the connection between the second application and the first TCP proxy server; the first TCP proxy server is further configured to send the fourth message to the NAS device; the NAS device is further configured to send the fourth payload to a first port of a virtual server in the NAS device based on the fourth message, so that the virtual server in the NAS device sends the fourth payload to the application service corresponding to the fourth payload.

[0018] In conjunction with the second aspect, in some implementations of the second aspect, the first electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The second application is further configured to send a fifth request to the second TCP proxy server. The second TCP proxy server is further configured to generate a fifth message based on the fifth request. The fifth message includes a fifth TCP proxy header and a fifth payload. The fifth TCP proxy header includes a fifth type field and a fifth index field. The fifth type field indicates the type of the fifth message, and the fifth index field indicates the connection between the second application and the second TCP proxy server. The second TCP proxy server is further configured to send the fifth message to the NAS device. The NAS device is further configured to send the fifth payload to the second port of the virtual server in the NAS device based on the fifth message, so that the virtual server in the NAS device sends the fifth payload to the application service corresponding to the fifth payload.

[0019] In conjunction with the second aspect, in some implementations of the second aspect, the system further includes a second electronic device that establishes a TCP proxy with the NAS device. The second electronic device includes a third TCP proxy server and a third application. The port of the third TCP proxy server corresponds to the third port of the virtual server in the NAS device. The first TCP proxy header further includes a first session field, which is used to indicate the session identifier between the first electronic device and the NAS device. The third application is further used to send a sixth request to the third TCP proxy server. The third TCP proxy server is further used to generate a sixth message based on the sixth request. The sixth message includes a sixth TCP proxy header and a sixth... The payload, the sixth TCP proxy header, includes a sixth type field, a sixth index field, and a second session field. The sixth type field indicates the type of the sixth message, the sixth index field indicates the connection between the third application and the third TCP proxy server, and the second session field indicates the session identifier between the second electronic device and the NAS device. The third TCP proxy server is also used to send the sixth message to the NAS device. The NAS device is also used to send the sixth payload to the third port of the virtual server in the NAS device according to the sixth message, so that the virtual server in the NAS device sends the sixth payload to the application service corresponding to the sixth payload.

[0020] In this embodiment, by adding a session field to the TCP proxy header, the NAS device can determine the source of the received packet based on the session field. Since the NAS device can determine the source of the packet through the session field, it can receive packets from multiple electronic devices.

[0021] In conjunction with the second aspect, in some implementations of the second aspect, the first electronic device further includes a control module, wherein the first TCP server is specifically configured to: send the first message and the second message to the control module; the control module is configured to determine the sending order of the first message and the second message; and the control module is further configured to send the first message and the second message to the NAS device according to the determined sending order.

[0022] In conjunction with the second aspect, in some implementations of the second aspect, the first TCP proxy header also includes a first length field, which is used to indicate the length of the first payload.

[0023] The third aspect provides a method for accessing a NAS device. This method is applied to an electronic device that establishes a TCP proxy with the NAS device. The electronic device includes a first TCP proxy server and a first application. The port of the first TCP proxy server corresponds to a first port of a virtual server in the NAS device. The method includes: the first application sending a first request to the first TCP proxy server; the first TCP proxy server generating a first message based on the first request, the first message including a first TCP proxy header and a first payload. The first TCP proxy header includes a first type field and a first index field. The first type field indicates the type of the first message, and the first index field indicates the connection between the first application and the first TCP proxy server; the first TCP proxy server further sending the first message to the NAS device to enable the electronic device to access the NAS device.

[0024] In this embodiment, by creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling the VPN service, and it does not affect the creation of VPN services for other services of the electronic device.

[0025] In conjunction with the third aspect, in some implementations of the third aspect, the method further includes: the first application is further configured to send a second request to the first TCP proxy server; the first TCP proxy server is further configured to generate a second message according to the second request, the second message including a second TCP proxy header and a second payload, the second TCP proxy header including a second type field and a second index field, the second type field being used to indicate the type of the second message, and the second index field being used to indicate the connection between the first application and the first TCP proxy server; the first TCP proxy server is further configured to send the second message to the NAS device to enable the electronic device to access the NAS device.

[0026] In conjunction with the third aspect, in some implementations of the third aspect, the first electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The method further includes: the first application, which is further configured to send the third request to the second TCP proxy server; the second TCP proxy server, which is configured to generate a third message based on the third request, the third message including a third TCP proxy header and a third payload, the third TCP proxy header including a third type field and a third index field, the third type field indicating the type of the third message, and the third index field indicating the connection between the first application and the second TCP proxy server; the second TCP proxy server, which is further configured to send the third message to the NAS device to enable the electronic device to access the NAS device.

[0027] In conjunction with the third aspect, in some implementations of the third aspect, the first electronic device further includes a second application, and the method further includes: the second application being configured to send a fourth request to the first TCP proxy server; the first TCP proxy server being configured to generate a fourth message based on the fourth request, the fourth message including a fourth TCP proxy header and a fourth payload, the fourth TCP proxy header including a fourth type field and a fourth index field, the fourth type field being used to indicate the type of the fourth message, and the fourth index field being used to indicate the connection between the second application and the first TCP proxy server; the first TCP proxy server being configured to send the fourth message to the NAS device to enable the electronic device to access the NAS device.

[0028] In conjunction with the third aspect, in some implementations of the third aspect, the electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The method further includes: the second application, which is further configured to send a fifth request to the second TCP proxy server; the second TCP proxy server, which is further configured to generate a fifth message based on the fifth request, the fifth message including a fifth TCP proxy header and a fifth payload, the fifth TCP proxy header including a fifth type field and a fifth index field, the fifth type field indicating the type of the fifth message, and the fifth index field indicating the connection between the second application and the second TCP proxy server; and the second TCP proxy server, which is further configured to send the fifth message to the NAS device to enable the electronic device to access the NAS device.

[0029] In conjunction with the third aspect, in some implementations of the third aspect, the first electronic device further includes a control module, wherein the first TCP server is specifically configured to: send the first message and the second message to the control module; the control module is configured to determine the sending order of the first message and the second message; the control module is further configured to send the first message and the second message to the NAS device according to the determined sending order so that the electronic device can access the NAS device.

[0030] In conjunction with the third aspect, in some implementations of the third aspect, the first TCP proxy header further includes a first length field and / or a first session field, wherein the first length field is used to indicate the length of the first payload and the first session field is used to indicate the session identifier between the electronic device and the NAS device.

[0031] In this embodiment, by adding a session field to the TCP proxy header, the NAS device can determine the source of the received packet based on the session field. Since the NAS device can determine the source of the packet through the session field, it can receive packets from multiple electronic devices.

[0032] The fourth aspect provides an electronic device comprising modules / units for performing the methods described above or any possible design of the above aspects; these modules / units may be implemented in hardware or by executing corresponding software in hardware.

[0033] The fifth aspect provides a NAS device comprising modules / units that perform the methods described above or any of the possible designs described above; these modules / units may be implemented in hardware or by executing corresponding software in hardware.

[0034] The sixth aspect provides a chip coupled to a memory in an electronic device for calling a computer program stored in the memory and executing the technical solutions of the above aspects of the embodiments of this application and any possible design of the above aspects; in the embodiments of this application, "coupling" means that two components are directly or indirectly combined with each other.

[0035] The seventh aspect provides a computer-readable storage medium including a computer program that, when executed on an electronic device, causes the electronic device to perform the technical solutions described above and any possible design thereof.

[0036] Eighthly, a computer program according to an embodiment of this application includes instructions that, when executed on a computer, cause the computer to perform the technical solutions described above and any possible design thereof.

[0037] Ninth aspect, an electronic device according to an embodiment of this application, the electronic device includes one or more processors; one or more memories; the one or more memories store one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the above aspects or any possible implementation of the above aspects to be performed.

[0038] A tenth aspect is a NAS device according to an embodiment of this application. The NAS device includes one or more processors; one or more memories; the one or more memories store one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the above aspects or any possible implementation thereof to be performed.

[0039] For the beneficial effects of aspects four through ten, please refer to the beneficial effects of aspects one through three, which will not be repeated here. Attached Figure Description

[0040] Figure 1 This is a schematic diagram illustrating an application scenario applicable to the embodiments of this application.

[0041] Figure 2 This is a diagram illustrating how a remote electronic device accesses a NAS device.

[0042] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0043] Figure 4 This is a software structure block diagram of an electronic device provided in an embodiment of this application.

[0044] Figure 5This is a schematic diagram of the system architecture provided in the embodiments of this application.

[0045] Figure 6 This is a schematic diagram of the data flow of the electronic device provided in the embodiments of this application.

[0046] Figure 7 This is a schematic structural diagram of the TCP proxy header provided in the embodiments of this application.

[0047] Figure 8 This is a schematic diagram of the data flow of the NAS device provided in the embodiments of this application.

[0048] Figure 9 This is a schematic diagram of an electronic device accessing a NAS device according to an embodiment of this application.

[0049] Figure 10 This is a schematic diagram of another electronic device accessing a NAS device provided in an embodiment of this application.

[0050] Figure 11 This is a schematic diagram of another electronic device accessing a NAS device provided in an embodiment of this application.

[0051] Figure 12 This is a schematic diagram of multiple electronic devices accessing a NAS device according to an embodiment of this application.

[0052] Figure 13 This is a schematic diagram of an electronic device accessing a NAS device according to an embodiment of this application.

[0053] Figure 14 This is a schematic diagram of system interaction provided in an embodiment of this application.

[0054] Figure 15 This is a schematic diagram of system interaction provided in an embodiment of this application.

[0055] Figure 16 This is a schematic diagram of system interaction provided in an embodiment of this application.

[0056] Figure 17 This is a schematic diagram of system interaction provided in an embodiment of this application.

[0057] Figure 18 This is a schematic diagram of system interaction provided in an embodiment of this application. Detailed Implementation

[0058] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one” and “one or more” refer to one, two, or more than two. The term “and / or” is used to describe the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can indicate: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character “ / ” generally indicates that the preceding and following related objects are in an “or” relationship.

[0059] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0060] Before introducing the embodiments of this application, we will first introduce several concepts involved in the embodiments of this application.

[0061] Remote electronic device: In this application embodiment, an electronic device that is not on the same local area network as the NAS device is referred to as a remote electronic device. The remote electronic device can access the NAS device through a P2P channel. Accessing the NAS device by a remote electronic device can be understood as the remote electronic device and the NAS device being able to perform data transmission, such as the remote electronic device uploading data to the NAS device or downloading data from the NAS device.

[0062] Near-field electronic devices: In this embodiment of the application, electronic devices that are on the same local area network as the NAS device are referred to as near-field electronic devices.

[0063] NAS device: A device with data storage capabilities that supports access by other devices via a network. A NAS device includes storage devices (e.g., disk arrays, tape drives, or removable storage media) and embedded system software. NAS devices can be applied in various scenarios, such as home scenarios and industrial scenarios. In this application embodiment, a NAS device applied in a home scenario can be referred to as a home storage device.

[0064] To facilitate the introduction of the embodiments of this application, the application scenarios applicable to the embodiments of this application are described below.

[0065] Figure 1 This is a schematic diagram illustrating an application scenario applicable to the embodiments of this application.

[0066] like Figure 1 As shown, electronic devices 101, 102, and 103 can all access NAS device 104. Electronic device 101 accesses NAS device 104 locally, electronic device 102 accesses NAS device 104 remotely, and electronic device 103 accesses NAS device 104 remotely. As mentioned above, electronic device 101 is a local electronic device, while electronic devices 102 and 103 are remote electronic devices.

[0067] It should be noted that electronic devices 101, 102, and 103 may run on the same operating system or different operating systems, and this application embodiment does not impose any limitations on this.

[0068] It should also be noted that the application scenario diagrams illustrated in the embodiments of this application do not constitute a specific limitation on the number of electronic devices. In other embodiments of this application, the NAS device may be connected to more electronic devices or fewer electronic devices.

[0069] Figure 2 A schematic diagram of a remote electronic device accessing a NAS device is shown.

[0070] like Figure 2 As shown, when a remote electronic device needs to access a NAS device, it needs to establish a VPN service between the remote electronic device and the NAS device, utilizing a P2P channel to enable remote access. The VPN proxy server resides on the remote electronic device, while the VPN proxy client resides on the NAS device. The remote electronic device creates the VPN proxy server. Its business layer, acting as a client, can send Hypertext Transfer Protocol (HTTP) requests to the VPN proxy server. Upon receiving the HTTP request, the VPN proxy server forwards it to the NAS device via the P2P channel. Upon receiving the HTTP request, the NAS device forwards it to its VPN proxy client, which then sends the HTTP request to a virtual server within the NAS device, thus enabling the remote electronic device to access the NAS device's server.

[0071] As described above, remote electronic devices need to establish a VPN service when accessing a NAS device. However, establishing a VPN service requires obtaining VPN service permissions, which have a high permission level and must be manually enabled by the user. If the remote electronic device fails to obtain VPN service permissions, it cannot access the NAS device. Furthermore, an electronic device can only have one VPN service enabled at a time. If a remote electronic device uses a VPN service to access a NAS device, it cannot use other VPN services. In summary, accessing a NAS device by establishing a VPN service requires manual user intervention and may affect the operation of other services on the electronic device, thus reducing the user experience. Therefore, this application provides a method for accessing a NAS device where the remote electronic device does not need to obtain VPN service permissions and will not affect the creation of VPN services for other services on the remote electronic device.

[0072] The following describes an electronic device and embodiments for using such an electronic device. In some embodiments, the electronic device may be a portable device that also includes other functions such as a personal digital assistant and / or music player, such as a mobile phone, tablet computer, wearable device with wireless communication capabilities (such as a smartwatch), etc. Exemplary embodiments of the portable device include, but are not limited to, carrying... Alternatively, portable devices using other operating systems. These portable devices also include laptops, etc. It should also be understood that in some other embodiments, the aforementioned electronic devices also include desktop computers, smart TVs, large-screen devices, etc.

[0073] For example, Figure 3 A schematic diagram of the structure of electronic device 300 is shown. Electronic device 300 may include processor 310, external memory interface 320, internal memory 321, universal serial bus (USB) interface 330, charging management module 340, power management module 341, battery 342, antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, audio module 370, speaker 370A, receiver 370B, microphone 370C, headphone jack 370D, sensor module 380, compass 390, motor 391, indicator 392, camera 393, display screen 394, and subscriber identification module (SIM) card interface 395, etc.

[0074] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 300. In other embodiments of this application, the electronic device 300 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0075] Processor 310 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). Different processing units may be independent components or integrated into one or more processors. In some embodiments, electronic device 300 may also include one or more processors 310. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. In other embodiments, processor 310 may also include a memory for storing instructions and data. For example, the memory in processor 310 may be a cache memory. This memory can store instructions or data that processor 310 has just used or is reusing. If processor 310 needs to reuse the instruction or data, it can directly retrieve it from this memory. This avoids repeated accesses, reduces the waiting time of the processor 310, and thus improves the efficiency of the electronic device 300 in processing data or executing instructions.

[0076] In some embodiments, the processor 310 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. The USB interface 330 is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface 330 can be used to connect a charger to charge the electronic device 300, and can also be used for data transfer between the electronic device 300 and peripheral devices.

[0077] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 300. In other embodiments of this application, the electronic device 300 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0078] The wireless communication function of electronic device 300 can be realized through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor and baseband processor, etc.

[0079] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 300 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0080] The mobile communication module 350 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 300. The mobile communication module 350 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 350 may be housed in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 and at least some modules of the processor 310 may be housed in the same device.

[0081] The wireless communication module 360 ​​can provide solutions for wireless communication applications on the electronic device 300, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 360 ​​can be one or more devices integrating at least one communication processing module. The wireless communication module 360 ​​receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 310. The wireless communication module 360 ​​can also receive signals to be transmitted from processor 310, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0082] The external storage interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 300. The external memory card communicates with the processor 310 through the external storage interface 320 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0083] Internal memory 321 can be used to store one or more computer programs, which include instructions. Processor 310 can execute the instructions stored in internal memory 321, thereby causing electronic device 300 to perform the methods provided in some embodiments of this application, as well as various applications and data processing. Internal memory 321 may include a program storage area and a data storage area. The program storage area may store the operating system; the program storage area may also store one or more applications (such as a gallery, contacts, etc.). The data storage area may store data created during the use of electronic device 300 (such as photos, contacts, etc.). In addition, internal memory 321 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc. In some embodiments, processor 310 can execute instructions stored in internal memory 321 and / or instructions stored in memory disposed in processor 310, thereby causing electronic device 300 to perform the methods provided in embodiments of this application, as well as other applications and data processing.

[0084] Figure 4 This is a software structure block diagram of an electronic device 300 according to an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer. The application layer may include a series of application packages.

[0085] like Figure 4 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0086] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes some predefined functions.

[0087] like Figure 4 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0088] The window manager is used to manage window programs. The window manager can obtain the screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0089] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0090] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0091] The phone manager is used to provide communication functions for electronic devices 300. For example, it manages call status (including connection and disconnection).

[0092] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and so on.

[0093] The notification manager allows applications to display notifications in the status bar. These notifications can be used to convey informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0094] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0095] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0096] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, and MP3.

[0097] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0098] A 2D graphics engine is a graphics engine for 2D drawing.

[0099] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, and sensor drivers.

[0100] The following will combine Figures 5-18 This application describes a method for accessing a NAS device provided by an embodiment.

[0101] Figure 5 A schematic diagram of the system architecture provided in an embodiment of this application is shown.

[0102] like Figure 5 As shown in this embodiment, a Transmission Control Protocol (TCP) proxy is established between the electronic device and the NAS device, and the TCP proxy server is deployed in the proxy layer of the electronic device. This electronic device can be a local electronic device or a remote electronic device.

[0103] It should be noted that a TCP proxy server is a virtual server inside an electronic device. A TCP proxy server can be implemented through computer program instructions and is used to handle HTTP requests sent by one or more applications of the electronic device.

[0104] A connection can be established between the electronic device's business layer and the TCP proxy server. The business layer acts as a client, sending HTTP requests to the proxy layer. The proxy layer acts as a server, receiving HTTP requests from the business layer. The business layer of the electronic device can be understood as the layer used to request or upload data from the NAS device. It includes one or more applications to implement the various functions of the electronic device. These applications can act as clients, sending HTTP requests to the TCP proxy server. For example, the business layer may include a photo album application, a video application, and an application for managing the NAS device. The photo album application can upload photos stored on the electronic device to the NAS device, and the video application can upload cached videos from the electronic device. The application for managing the NAS device can manage the data stored on the NAS device. The proxy layer of the electronic device can be understood as the layer of the TCP proxy server deployed within the electronic device.

[0105] The service layer of a NAS device can establish a connection with a server. The service layer of the NAS device acts as a client, sending messages to the server. These messages can be data messages or control messages. The server in the NAS device acts as a server, receiving messages sent by the service layer. The service layer of a NAS device can be understood as the layer used to parse messages from electronic devices.

[0106] It should be noted that the server in a NAS device can be a virtual server within the NAS device itself. This virtual server can be implemented through computer program instructions and can be used to manage received messages. For example, the server in a NAS device can be an Nginx server or another type of server.

[0107] The service layer of a NAS device includes one or more application services. These services enable functions such as file sharing and multimedia playback. Upon receiving a message, the NAS device can forward it to the corresponding application service based on its type. For example, a NAS device might include an image management application service, which allows it to manage images uploaded by electronic devices.

[0108] Electronic devices and NAS devices can connect and communicate via a P2P channel, allowing the electronic device to obtain the Internet Protocol (IP) address and port of the NAS device's virtual server. A correspondence can be established between the port of the TCP proxy server created in the electronic device and a port of the NAS device's virtual server via the type field of the TCP proxy header. For example, if the control channel port of the NAS device's virtual server is 8431 and the control channel port of the electronic device's TCP proxy server is 35271, and these two ports correspond, the NAS device, after receiving a message from the TCP server, can forward that message to port 8431 of the NAS device's virtual server. A description of the TCP proxy header is provided below.

[0109] Understandably, if a NAS device includes multiple sets of IP addresses and ports, the electronic device can create multiple corresponding TCP proxy servers based on these multiple sets of IP addresses and ports.

[0110] The method for connecting electronic devices and NAS devices via a P2P channel is not limited in the embodiments of this application. For example, electronic devices and NAS devices can be connected via a relay server.

[0111] For example, electronic devices can be directly connected to NAS devices via P2P.

[0112] It should be noted that, Figure 5The number of clients in the business layer of the electronic device, the TCP proxy server in the proxy layer, and the clients in the business layer of the NAS device are merely examples and should not be construed as a specific limitation on the number of clients in the business layer of the electronic device, the TCP proxy server in the proxy layer, and the clients in the business layer of the NAS device. In other embodiments of this application, the number of clients in the business layer of the electronic device, the TCP proxy server in the proxy layer, and the clients in the business layer of the NAS device may be more or less than shown in the figures.

[0113] The system architecture provided in the embodiments of this application has been described above. The data flow of electronic devices and NAS devices will be described below.

[0114] Figure 6 A schematic diagram of the data flow of an electronic device provided in an embodiment of this application is shown.

[0115] like Figure 6 As shown, client #1 in the business layer can send an HTTP request #1 to the IP address and port of TCP proxy server #1. This HTTP request #1 includes one of the following: POST request, GET request, HEAD request, PUT request, OPTIONS request, DELETE request, CONECT request, and TRACE request. Client #1 can upload data to or request data from the NAS device through the HTTP request #1.

[0116] For example, client #1 can upload photos stored on electronic devices to the NAS device via HTTP request #1.

[0117] For example, client #1 can retrieve photos stored on the NAS device from the NAS device via an HTTP request #1.

[0118] After receiving the HTTP request #1, TCP proxy server #1 establishes a connection with client #1. TCP proxy server #1 can determine the payload #1 of the socket for this connection based on the HTTP request #1. After determining the payload #1, TCP proxy server #1 can add a TCP proxy header #1 to the payload #1, and then send the payload #1 with the TCP proxy header #1 to the NAS device through the P2P channel. In this embodiment, the payload with the added TCP proxy header is referred to as a message.

[0119] For example, a TCP proxy header can be added to the beginning of payload#1.

[0120] This application defines a TCP proxy header for accessing NAS devices. Figure 7 A schematic structural diagram of the TCP proxy header provided in an embodiment of this application is shown.

[0121] like Figure 7 As shown, the TCP proxy header includes a type field and an index field.

[0122] The type field is used to indicate the type of message, which includes data messages and control messages.

[0123] Different ports of the virtual servers in a NAS device are used to receive different types of packets. When creating a TCP proxy server, the electronic device can create different TCP proxy servers based on these different ports, allowing these different TCP proxy servers to send different types of packets, i.e., to different ports of the virtual servers in the NAS device. When adding a TCP proxy header, the TCP proxy server can use a type field to indicate the type of the packet. Therefore, after receiving a packet, the NAS device can send the packet payload to the corresponding port based on the type indicated by the type field.

[0124] For example, assuming a type field of "0" indicates a data packet and a type field of "1" indicates a control packet, the NAS device's virtual server includes ports #1 and #2. Port #1 is used to receive control packets, and port #2 is used to receive data packets. The electronic device can create TCP proxy servers #1 and #2. TCP proxy server #1 is used to send control packets, and TCP proxy server #2 is used to send data packets. TCP proxy server #1 uses port #3, and TCP proxy server #2 uses port #4. When sending control packets, TCP proxy server #1 adds a TCP proxy header with a type field of "1" to the payload. When sending data packets, TCP proxy server #2 adds a TCP proxy header with a type field of "0" to the payload. After receiving a packet, if the NAS device parses the type field and finds it to be "1", it sends the packet's payload to port #1; if it parses the type field and finds it to be "0", it sends the packet's payload to port #2.

[0125] The index field is used to indicate the connection between the electronic device's client and the TCP proxy server. In this embodiment, the electronic device's client can establish a connection with the TCP proxy server, and the index field for different clients' connections to the TCP proxy server is different. The NAS device can establish a connection to the server based on the index field.

[0126] For example, both client#1 and client#2 are connected to TCP proxy server#1. TCP proxy server#1 can receive HTTP request#1 sent by client#1 and HTTP request#2 sent by client#2. TCP proxy server#1 determines payload#1 based on HTTP request#1, determines payload#2 based on HTTP request#2, and determines the TCP proxy header#1 added to payload#1 and the TCP proxy header#2 added to payload#2. The index field of TCP proxy header#1 can be "000" and the index field of TCP proxy header#2 can be "001".

[0127] Optionally, in some embodiments, the TCP proxy header may also include a length field.

[0128] The length field is used to indicate the length of the payload. After receiving a message sent by an electronic device, the NAS device can parse it to obtain the payload and the length field. The NAS device can then verify whether the payload meets the length indicated by the length field. When the NAS device determines that the length indicated by the length field is the same as the payload length, it can process the payload.

[0129] Optionally, in some embodiments, the TCP proxy header may also include a session field.

[0130] The session field can be understood as a session identifier between the electronic device and the NAS device. Similar to the index field, the session field is different for different electronic devices and the NAS device. The session identifier is assigned by the NAS device after the electronic device is connected to the NAS device.

[0131] For example, both electronic device #1 and electronic device #2 are connected to the NAS device via a P2P channel. After connecting to electronic devices #1 and #2, the NAS device can assign a session identifier "000" to electronic device #1 and a session identifier "001" to electronic device #2. Thus, the TCP proxy server in electronic device #1, upon receiving the payload from the client's HTTP request, adds a TCP proxy header to the payload. This TCP proxy header includes a session field, which is "000". Similarly, the TCP proxy server in electronic device #2 adds a session field of "001" to the TCP proxy header in the payload.

[0132] It is understood that, in this embodiment, by adding a session field to the TCP proxy header, the NAS device can determine the source of the received packet based on the session field. Since the NAS device can determine the source of the packet through the session field, it can receive packets from multiple electronic devices. In other words, this embodiment supports multiple electronic devices accessing the NAS device by adding a session field to the TCP proxy header.

[0133] Optionally, in some embodiments, the TCP proxy header may also include a reserved field.

[0134] The TCP proxy header in this embodiment may also include a reserved field, which can be customized.

[0135] For example, the type of data uploaded by the electronic device to the NAS device can be indicated by a reserved field. For instance, if the message is a data message, the reserved field "00" can indicate that the data message is video, and "01" can indicate that the data message is an image. If the message is a control message, the reserved field "10" can indicate that the control message is device information of the electronic device.

[0136] The above text combined Figure 6 and Figure 7 The data flow of the electronic device in the embodiments of this application has been described. The data flow of the NAS device provided in the embodiments of this application will be described below.

[0137] Figure 8 This application provides a schematic diagram illustrating the data flow of a NAS device according to an embodiment of the present application. Figure 8 As shown, the NAS device can receive message #1 sent by an electronic device, which may be sent by electronic device #1. Message #1 includes a TCP proxy header #1 and payload #1. The NAS device can determine payload #1 based on message #1, and then the service layer can act as a client to send payload #1 to the virtual server. After receiving payload #1, the virtual server can send payload #1 to the application service corresponding to payload #1.

[0138] For example, if payload#1 contains image data, the virtual server can send it to the image management application service after receiving it, so that the NAS device can manage the image data carried by payload#1.

[0139] In some examples, if the TCP proxy header includes a type field and an index field, i.e., TCP proxy header #1 includes a type field #1 and an index field #1, the NAS device can determine the type of message #1 based on the type field #1, thus determining the port to receive message #1. The NAS device can then create client #1 at the service layer based on the index field #1. This client #1 establishes a connection #1 with the virtual server to send payload #1 from message #1; that is, client #1 sends payload #1 to the virtual server. Since the NAS device can determine the type of message #1 through the type field #1, as mentioned above, different ports of the NAS device receive different types of messages. After determining the type of message #1, it can then determine the port to which to send message #1. In other words, the NAS device can send payload #1 to the port corresponding to the type field #1 through connection #1. When the NAS device receives another message containing the index field #1, it can continue to use connection #1 to send the payload of that message, i.e., continue to send the payload of that message to the server through client #1.

[0140] In some examples, if the TCP proxy header includes a type field, an index field, and a session field (i.e., TCP proxy header #1 includes a type field #1, an index field #1, and a session field #1), the NAS device can determine the type of packet #1 based on the type field #1 and determine that packet #1 originates from electronic device #1 based on the session field #1. The NAS device can then establish a connection #1 based on the index field #1 to send the payload #1 in packet #1; that is, client #1 sends payload #1 to the port corresponding to the type field #1.

[0141] In some examples, if the TCP proxy header includes a type field, an index field, and a length field (i.e., TCP proxy header #1 includes a type field #1, an index field #1, and a length field #1), the NAS device can determine the type of packet #1 based on the type field #1. The NAS device can verify the payload #1 of packet #1 based on the length field #1. If the verification is successful, the NAS device can establish a connection #1 based on the index field #1 to send the payload #1 from packet #1; that is, client #1 sends the payload #1 to the port corresponding to the type field #1. When the NAS device receives another packet containing the index field #1, it can continue to use connection #1 to send the payload of that packet, i.e., continue to send the payload of that packet to the server through client #1.

[0142] In some examples, if the TCP proxy header includes a type field, an index field, a length field, and a session field (i.e., the TCP proxy header includes type field #1, index field #1, length field #1, and session field #1), the NAS device can determine the type of packet #1 based on the type field #1. The NAS device can verify the payload #1 of packet #1 based on the length field #1. If the verification is successful, the NAS device can establish a connection #1 based on the index field #1 and session field #1 to send the payload #1 from packet #1; that is, client #1 sends the payload #1 to the port corresponding to the type field #1. When the NAS device receives another packet containing the index field #1 and session field #1, it can continue to use connection #1 to send the payload of that packet, i.e., continue to send the payload of that packet to the server through client #1.

[0143] In some examples, the TCP proxy header includes a type field #1, an index field #1, a length field #1, a session field #1, and a reservation field #1.

[0144] It is understandable that the description of the TCP proxy header including type field #1, index field #1, length field #1, session field #1 and reserved field #1 can be found in the description of the TCP proxy header including type field #1, index field #1, length field #1 and session field #1. For the sake of brevity, it will not be repeated here.

[0145] The above text combined Figure 8 Having received the data flow from the NAS device in this application embodiment, to more clearly illustrate the method for accessing the NAS device provided in this application implementation, the following will combine... Figures 9-13 This section introduces several examples of electronic devices accessing NAS devices.

[0146] Figure 9 A schematic diagram of an electronic device accessing a NAS device is shown in an embodiment of this application.

[0147] like Figure 9 As shown, client#1 sends HTTP request#1 and HTTP request#2 to TCP proxy server#1, where client#1 sends HTTP request#1 first and then HTTP request#2.

[0148] TCP proxy server #1 can determine payload #1 based on HTTP request #1 and add TCP proxy header #1 to payload #1 to construct message #1. It can also determine payload #2 based on HTTP request #2 and add TCP proxy header #2 to payload #2 to construct message #2.

[0149] In some examples, if the TCP proxy header includes a type field and an index field (i.e., TCP proxy header #1 includes type field #1 and index field #1, and TCP proxy header #2 includes type field #2 and index field #2), since HTTP request #1 and HTTP request #2 are sent by the same client and to the same TCP proxy server, then type field #1 and type field #2 are the same, and index field #1 and index field #2 are the same. The NAS device can establish connection #1 based on index field #1 to send payload #1 from message #1. Connection #1 is a connection between client #2 and the virtual server; that is, client #2 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. After receiving message #2, the NAS device can continue to send the payload #2 of message #2 to the virtual server through client #2.

[0150] In some examples, if the TCP proxy header includes a type field, an index field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, and session field #2—then, since HTTP request #1 and HTTP request #2 are sent by the same client from the same electronic device and to the same TCP proxy server, then type field #1 and type field #2 are the same, index field #1 and index field #2 are the same, and session field #1 and session field #2 are the same. The NAS device can establish connection #1 based on index field #1 to send payload #1 in message #1. Connection #1 is a connection between client #2 and the virtual server; that is, client #2 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. After receiving message #2, the NAS device can continue to send the payload #2 of message #2 to the virtual server through client #2.

[0151] In some examples, if the TCP proxy header includes a type field, an index field, and a length field—that is, TCP proxy header #1 includes type field #1, index field #1, and length field #1, and TCP proxy header #2 includes type field #2, index field #2, and length field #2—then, since HTTP request #1 and HTTP request #2 are sent by the same client and to the same TCP proxy server, type field #1 and type field #2 are the same, and index field #1 and index field #2 are the same. Length field #1 and length field #2 may or may not be the same. The NAS device can determine the type of packet #1 based on type field #1. The NAS device can verify the payload #1 of packet #1 based on length field #1. If the verification is successful, the NAS device can establish connection #1 based on index field #1 to send the payload #1 in packet #1. Connection #1 is a connection between client #2 and the virtual server; that is, client #2 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. After receiving message #2, the NAS device can verify it based on the length field #2 and payload #2. If the verification is successful, it can continue to send payload #2 to the virtual server through client #2.

[0152] In some examples, if the TCP proxy header includes a type field, an index field, a length field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, length field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, length field #2, and session field #2—then, since HTTP request #1 and HTTP request #2 are sent by the same client and to the same TCP proxy server, type field #1 and type field #2 are the same, index field #1 and index field #2 are the same, and session field #1 and session field #2 are the same. Length field #1 and length field #2 may or may not be the same. The NAS device can determine the type of message #1 based on type field #1. The NAS device can verify the payload #1 of message #1 based on the length field #1. If the verification is successful, the NAS device can establish connection #1 based on the index field #1 to send the payload #1 from message #1. Connection #1 is a connection between client #2 and the virtual server; that is, client #2 sends payload #1 to the virtual server. Connection #1 points to port #1 corresponding to the type field #1. After receiving message #2, the NAS device can verify it based on the length field #2 and payload #2. If the verification is successful, it can continue to send payload #2 to the virtual server through client #2.

[0153] In some examples, if the TCP proxy header includes a type field, an index field, a length field, a session field, and a reservation field, that is, TCP proxy header #1 may include type field #1, index field #1, length field #1, session field #1, and reservation field #1, TCP proxy header #2 may include type field #2, index field #2, length field #2, session field #2, and reservation field #2.

[0154] It should be understood that a description of the TCP proxy header, including the type field, index field, length field, session field, and reserved field, can be found in the section on TCP proxy header including the type field, index field, length field, and session field. For the sake of brevity, it will not be repeated here.

[0155] Figure 10 This illustration shows another schematic diagram of an electronic device accessing a NAS device, provided by an embodiment of this application.

[0156] like Figure 10 As shown, client#1 sends HTTP request#1 to TCP proxy server#1, and client#2 sends HTTP request#2 to TCP proxy server#1.

[0157] After receiving HTTP request #1 and HTTP request #2, TCP proxy server #1 can determine payload #1 based on HTTP request #1 and add TCP proxy header #1 to payload #1 to construct message #1. It can also determine payload #2 based on HTTP request #2 and add TCP proxy header #2 to payload #2 to construct message #2.

[0158] In some examples, if the TCP proxy header includes a type field and an index field (i.e., TCP proxy header #1 includes type field #1 and index field #1, and TCP proxy header #2 includes type field #2 and index field #2), and since HTTP request #1 and HTTP request #2 are sent by different clients but to the same TCP proxy server, then type field #1 and type field #2 are the same, while index field #1 and index field #2 are different. The NAS device can establish connection #1 based on index field #1 to send payload #1 in message #1. Connection #1 is the connection between client #3 and the virtual server, meaning client #3 sends payload #1 to the virtual server. Similarly, it can establish connection #2 based on index field #2 to send payload #2 in message #2. Connection #2 is the connection between client #4 and the virtual server, meaning client #4 sends payload #2 to the virtual server. Connections #1 and #2 point to port #1 corresponding to type fields #1 and #2, respectively.

[0159] In some examples, if the TCP proxy header includes a type field, an index field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, and session field #2—then, since HTTP request #1 and HTTP request #2 are sent by different clients of the same electronic device and are sent to the same TCP proxy server, then type field #1 and type field #2 are different, while index field #1 and index field #2 are the same, and session field #1 and session field #2 are the same. The NAS device can establish connection #1 based on index field #1 to send payload #1 in message #1. Connection #1 is the connection between client #3 and the virtual server, meaning client #3 sends payload #1 to the virtual server. Similarly, it can establish connection #2 based on index field #2 to send payload #2 in message #2. Connection #2 is the connection between client #4 and the virtual server, meaning client #4 sends payload #2 to the virtual server. Connections #1 and #2 point to port #1 corresponding to type fields #1 and #2, respectively.

[0160] In some examples, if the TCP proxy header includes a type field, an index field, and a length field—that is, TCP proxy header #1 includes type field #1, index field #1, and length field #1, and TCP proxy header #2 includes type field #2, index field #2, and length field #2—then, since HTTP request #1 and HTTP request #2 are not sent by the same client but are both sent to the same TCP proxy server, type field #1 and type field #2 are the same, while index field #1 and index field #2 are different. Length field #1 and length field #2 can be the same or different. The NAS device can determine the type of packet #1 based on type field #1. The NAS device can verify the payload #1 of packet #1 based on length field #1. If the verification is successful, the NAS device can establish connection #1 based on index field #1 to send the payload #1 in packet #1. Connection #1 is a connection between client #3 and the virtual server; that is, client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. Similarly, the NAS device can determine the type of packet #2 based on type field #2. The NAS device can verify the payload #2 of message #2 based on the length field #2. If the verification is successful, the NAS device can establish a connection #2 based on the index field #2 to send the payload #2 in message #2. Connection #2 is a connection between client #4 and the virtual server, that is, client #4 sends payload #2 to the virtual server. Connection #2 points to port #1 corresponding to the type field #1.

[0161] In some embodiments, if the TCP proxy header includes a type field, an index field, a length field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, length field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, length field #2, and session field #2—since HTTP request #1 and HTTP request #2 are not sent by the same client, but are both sent to the same TCP proxy server and are both sent by the same electronic device, then type field #1 and type field #2 are the same, index field #1 and index field #2 are different, and session field #1 and session field #2 are the same. Length field #1 and length field #2 may be the same or different. The NAS device can determine the type of message #1 based on type field #1. The NAS device can verify the payload #1 of message #1 based on the length field #1. If the verification is successful, the NAS device can establish connection #1 based on the index field #1 to send the payload #1 from message #1. Connection #1 is the connection between client #3 and the virtual server; that is, client #3 sends payload #1 to the virtual server. Connection #1 points to port #1 corresponding to the type field #1. Similarly, the NAS device can determine the type of message #2 based on the type field #2. The NAS device can verify the payload #2 of message #2 based on the length field #2. If the verification is successful, the NAS device can establish connection #2 based on the index field #2 to send the payload #2 from message #2. Connection #2 is the connection between client #4 and the virtual server; that is, client #4 sends payload #2 to the virtual server. Connection #2 points to port #1 corresponding to the type field #1.

[0162] In some examples, if the TCP proxy header includes a type field, an index field, a length field, a session field, and a reservation field, that is, TCP proxy header #1 may include type field #1, index field #1, length field #1, session field #1, and reservation field #1, TCP proxy header #2 may include type field #2, index field #2, length field #2, session field #2, and reservation field #2.

[0163] It should be understood that a description of the TCP proxy header, including the type field, index field, length field, session field, and reserved field, can be found in the section on TCP proxy header including the type field, index field, length field, and session field. For the sake of brevity, it will not be repeated here.

[0164] Figure 11 This illustration shows another schematic diagram of an electronic device accessing a NAS device, provided by an embodiment of this application.

[0165] like Figure 11As shown, client#1 sends HTTP request#1 to TCP proxy server#1, and client#2 sends HTTP request#2 to TCP proxy server#2.

[0166] After receiving HTTP request #1, TCP proxy server #1 can determine the payload #1 and add a TCP proxy header #1 to the payload #1 to construct message #1. After receiving HTTP request #2, TCP proxy server #2 can determine the payload #2 and add a TCP proxy header #2 to the payload #2 to construct message #2. Electronic devices can send messages #1 and #2 to the NAS device.

[0167] In some examples, if the TCP proxy header includes a type field and an index field (i.e., TCP proxy header #1 includes type field #1 and index field #1, and TCP proxy header #2 includes type field #2 and index field #2), then since HTTP requests #1 and #2 are sent by different clients and the TCP proxy servers receiving them are different, the type field #1 and type field #2, and the index field #1 and index field #2, will be different. The NAS device can establish connection #1 based on index field #1 to send payload #1 in message #1. Connection #1 is a connection between client #3 and the virtual server, meaning client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. Similarly, the NAS device can establish connection #2 based on index field #2 to send payload #2 in message #2. Connection #1 is a connection between client #4 and the virtual server, meaning client #4 sends payload #2 to the virtual server, where connection #2 points to port #2 corresponding to type field #2.

[0168] In some examples, if the TCP proxy header includes a type field, an index field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, and session field #2—since HTTP request #1 and HTTP request #2 are sent by different clients of the same electronic device, and the TCP proxy servers receiving HTTP request #1 and HTTP request #2 are different, then type field #1 and type field #2 will be different, index field #1 and index field #2 will be different, and session field #1 and session field #2 will be the same. The NAS device can establish connection #1 based on index field #1 to send payload #1 in message #1. Connection #1 is a connection between client #3 and the virtual server; that is, client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. The NAS device establishes connection #2 based on index field #2 to send payload #2 in message #2. Connection #2 is a connection between client #4 and the virtual server, that is, client #4 sends payload #2 to the virtual server. Connection #2 points to port #2 corresponding to type field #2.

[0169] In some examples, if the TCP proxy header includes a type field, an index field, and a length field (i.e., TCP proxy header #1 includes type field #1, index field #1, and length field #1, and TCP proxy header #2 includes type field #2, index field #2, and length field #2), then since HTTP request #1 and HTTP request #2 are not sent by the same client, and the TCP proxy servers receiving HTTP request #1 and HTTP request #2 are different, the type field #1 and type field #2 will be the same, while the index field #1 and index field #2 will be different. The length field #1 and length field #2 can be the same or different. The NAS device can determine the type of packet #1 based on the type field #1. The NAS device can verify the payload #1 of packet #1 based on the length field #1. If the verification is successful, the NAS device can establish connection #1 based on the index field #1 to send the payload #1 in packet #1. Connection #1 is a connection between client #3 and the virtual server, meaning client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. Similarly, the NAS device can determine the type of message #2 based on the type field #2. The NAS device can verify the payload #2 of message #2 based on the length field #2. If the verification is successful, the NAS device can establish connection #2 based on the index field #2 to send the payload #2 in message #2. Connection #2 is a connection between client #4 and the virtual server, that is, client #4 sends payload #2 to the virtual server, where connection #2 points to port #2 corresponding to the type field #2.

[0170] In some examples, if the TCP proxy header includes a type field, an index field, a length field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, length field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, length field #2, and session field #2—then, since HTTP request #1 and HTTP request #2 are not sent by the same client, and the TCP proxy servers receiving HTTP request #1 and HTTP request #2 are different, then type field #1 and type field #2 will be different, index field #1 and index field #2 will be different, and session field #1 and session field #2 will be the same. Length field #1 and length field #2 may be the same or different. The NAS device can determine the type of message #1 based on type field #1. The NAS device can verify the payload#1 of message#1 based on the length field #1. If the verification is successful, the NAS device can establish connection#1 based on the index field #1 to send the payload#1 from message#1. Connection#1 is the connection between client#3 and the virtual server, meaning client#3 sends payload#1 to the virtual server. Connection#1 points to port#1 corresponding to the type field #1. Similarly, the NAS device can determine the type of message#2 based on the type field #2. The NAS device can verify the payload#2 of message#2 based on the length field #2. If the verification is successful, the NAS device can establish connection#2 based on the index field #2 to send the payload#2 from message#2. Connection#2 is the connection between client#4 and the virtual server, meaning client#4 sends payload#2 to the virtual server. Connection#2 points to port#2 corresponding to the type field #2.

[0171] In some examples, if the TCP proxy header includes a type field, an index field, a length field, a session field, and a reservation field, that is, TCP proxy header #1 may include type field #1, index field #1, length field #1, session field #1, and reservation field #1, TCP proxy header #2 may include type field #2, index field #2, length field #2, session field #2, and reservation field #2.

[0172] It should be understood that a description of the TCP proxy header, including the type field, index field, length field, session field, and reserved field, can be found in the section on TCP proxy header including the type field, index field, length field, and session field. For the sake of brevity, it will not be repeated here.

[0173] The above text combined Figures 9-11 This application describes an electronic device sending one or more messages to a NAS device. The method for accessing a NAS device provided in this embodiment also supports multiple electronic devices accessing the NAS device. The following will combine... Figure 12 This application describes a method for accessing a NAS device provided by an embodiment.

[0174] Figure 12 This illustration shows a schematic diagram of multiple electronic devices accessing a NAS device according to an embodiment of this application.

[0175] like Figure 12 As shown, client #1 of electronic device #1 sends HTTP request #1 to TCP proxy server #1. Client #2 of electronic device #2 sends HTTP request #2 to TCP proxy server #2.

[0176] After receiving HTTP request #1, TCP proxy server #1 can determine the payload #1 and add a TCP proxy header #1 to the payload #1 to construct message #1. After receiving HTTP request #2, TCP proxy server #2 can determine the payload #2 and add a TCP proxy header #2 to the payload #2 to construct message #2. Electronic device #1 can send message #1 to NAS device. Electronic device #2 can send message #2 to NAS device.

[0177] In some examples, if the TCP proxy header includes a type field, an index field, and a session field—that is, TCP proxy header #1 includes type field #1, index field #1, and session field #1, and TCP proxy header #2 includes type field #2, index field #2, and session field #2—then, since HTTP request #1 and HTTP request #2 are not sent by clients on the same electronic device, index field #1 and index field #2 will be different, and session field #1 and session field #2 will also be different. Type field #1 and type field #2 may or may not be the same.

[0178] One possible implementation is that type field #1 and type field #2 are the same.

[0179] like Figure 12As shown in (a), when electronic device #1 creates TCP proxy server #1 and electronic device #2 creates TCP proxy server #2, the ports of TCP proxy server #1 and TCP proxy server #2 correspond to the port #1 of the virtual server in the NAS device. Therefore, type field #1 and type field #2 are the same. The NAS device can establish connection #1 based on index field #1 and session field #1 to send payload #1 in message #1. Connection #1 is the connection between client #3 and the virtual server, meaning client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. The NAS device establishes connection #2 based on index field #2 and session field #2 to send payload #2 in message #2. Connection #2 is the connection between client #4 and the virtual server, meaning client #4 sends payload #2 to the virtual server, where connection #2 points to port #1 corresponding to type field #2.

[0180] One possible implementation is that type field #1 and type field #2 are different.

[0181] like Figure 12 As shown in (b), when electronic device #1 creates TCP proxy server #1, it makes the port of TCP proxy server #1 correspond to the port #1 of the virtual server in the NAS device. When electronic device #2 creates TCP proxy server #2, it makes the port of TCP proxy server #2 correspond to the port #2 of the virtual server in the NAS device. Therefore, type field #1 and type field #2 are different. The NAS device can establish connection #1 based on index field #1 and session field #1 to send payload #1 in message #1. Connection #1 is the connection between client #3 and the virtual server, that is, client #3 sends payload #1 to the virtual server, where connection #1 points to port #1 corresponding to type field #1. The NAS device establishes connection #2 based on index field #2 and session field #2 to send payload #2 in message #2. Connection #2 is the connection between client #4 and the virtual server, that is, client #4 sends payload #2 to the virtual server, where connection #2 points to port #2 corresponding to type field #2.

[0182] In some examples, if the TCP proxy header includes a type field, an index field, a session field, and a length field—that is, TCP proxy header #1 includes type field #1, index field #1, session field #1, and length field #1, and TCP proxy header #2 includes type field #2, index field #2, session field #2, and length field #2—then, since HTTP request #1 and HTTP request #2 are not sent by clients on the same electronic device, index field #1 and index field #2 will be different, and session field #1 and session field #2 will also be different. Type field #1 and type field #2 may be the same or different; please refer to the above for details.

[0183] The NAS device can perform validation based on payload#1 and length field #1. If validation is successful, it establishes connection #1 based on index field #1 and session field #1 to send payload#1 from message #1. Connection #1 is the connection between client #3 and the virtual server; that is, client #3 sends payload#1 to the virtual server. Connection #1 points to the port corresponding to type field #1. The NAS device can also perform validation based on payload#2 and length field #2. If validation is successful, it establishes connection #2 based on index field #2 and session field #2 to send payload#2 from message #2. Connection #2 is the connection between client #4 and the virtual server; that is, client #4 sends payload#2 to the virtual server. Connection #2 points to the port corresponding to type field #2.

[0184] It is understandable that if type field #1 and type field #2 are the same, then client #3 and client #4 in the NAS device will send messages to the same port. If type field #1 and type field #2 are different, then client #3 and client #4 in the NAS device will send messages to different ports.

[0185] The above text combined Figures 9-12 This paper describes a method for one or more electronic devices to access a NAS device. In this embodiment, the electronic device can also control the sending order of messages. The following will combine... Figure 13 This application describes a method for accessing a NAS device provided by an embodiment.

[0186] Figure 13 The illustration shows a schematic diagram of an electronic device accessing a NAS device according to an embodiment of this application. The electronic device includes a control module for controlling the order in which messages are sent.

[0187] like Figure 13As shown, the electronic device's service layer can send HTTP requests to the TCP proxy server in the proxy layer. The proxy layer determines the payload based on the HTTP request and then adds a TCP proxy header to the payload to construct the message. The TCP server in the proxy layer can then send the message to the control module. As shown in the figure, when the TCP proxy server in the proxy layer sends messages to the control module, the message order is message #1, message #2, message #3, message #4. After receiving the messages sent by the TCP proxy server in the proxy layer, the control module can sort them according to preset rules, adjusting the message order to message #3, message #4, message #1, message #2. After the control module determines the message sending order, the electronic device can send the messages to the NAS device according to the sending order determined by the control module.

[0188] In this embodiment of the application, the control module can determine the message sending order in the following ways.

[0189] One possible approach is for the control module to determine the message sending order based on the message type.

[0190] For example, the control module can determine that the sending priority of control messages is higher than that of data messages. If the messages to be sent include both control messages and data messages, the control module can determine that the sending order of control messages is before that of data messages.

[0191] For example, the control module can determine that the sending priority of data packets is higher than that of control packets. If the packets to be sent include both control packets and data packets, the control module can determine that the sending order of data packets is before that of control packets.

[0192] It should be noted that if the message includes multiple control messages and / or multiple data messages, the order in which these multiple control messages and / or multiple data messages are sent can be in chronological order or in random order.

[0193] One possible implementation is that the control module determines the message sending order based on the message size.

[0194] For example, the control module may determine to send the smaller message first, and then send the larger message.

[0195] For example, the control module can determine to send the larger message first, and then send the smaller message.

[0196] One possible implementation is that the control module determines the message sending order based on the message type and message size.

[0197] For example, the control module can determine that the transmission priority of control messages is higher than that of data messages. If the messages to be sent include both control messages and data messages, the control module can determine that the transmission order of control messages precedes that of data messages. Furthermore, if the messages include multiple control messages and / or multiple data messages, the control module can determine, based on the size of the multiple control messages and / or multiple data messages, to send smaller data messages first, followed by larger data messages, thereby determining the transmission order of each control message and / or each data message.

[0198] The above text provided an illustration of accessing NAS devices via electronic devices. The following text will combine... Figure 14 The illustrated system interaction diagram of this application embodiment describes the method for accessing NAS devices provided by this application embodiment.

[0199] Figure 14 This illustration shows a system interaction diagram provided by an embodiment of this application. The system includes a first electronic device and a NAS device. The first electronic device and the NAS device establish a TCP proxy. The first electronic device includes a first TCP proxy server and a first application. The port of the first TCP proxy server corresponds to the first port of the virtual server in the NAS device. The system can perform the following steps:

[0200] S1401, the first application sends a first request to the first TCP proxy server.

[0201] Correspondingly, the first TCP proxy server receives the first request sent by the first application.

[0202] The first application can send HTTP requests to the first TCP proxy server; that is, the application can be... Figure 6 The client shown can be an application for managing NAS devices, or it can be other applications, such as video applications, music applications, etc.

[0203] S1402, the first TCP proxy server generates the first message based on the first request.

[0204] The first TCP proxy server generates a first message based on the first request. The first message includes a first TCP proxy header and a first payload. The first TCP proxy header includes a first type field and a first index field. The first type field is used to indicate the type of the first message, and the first index field is used to indicate the connection between the first application and the first TCP proxy server.

[0205] S1403, the first TCP proxy server sends the first message to the NAS device.

[0206] Correspondingly, the NAS device receives the first message sent by the first TCP proxy server.

[0207] The first TCP proxy server can send the first message to the NAS device through the P2P channel.

[0208] S1404, the NAS device sends the first payload to the first port according to the first message so that the first payload is sent to the application service corresponding to the first payload.

[0209] After receiving the first packet, the NAS device can parse the first TCP proxy header of the first packet. The port can be determined from the first type field. The first payload can then be sent to the first port of the virtual server in the NAS device, so that the virtual server in the NAS device will send the first payload to the application service corresponding to the first payload, thereby enabling electronic devices to access the NAS device.

[0210] In this embodiment, by creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling the VPN service, and it does not affect the creation of VPN services for other services of the electronic device.

[0211] In some embodiments, the system may also perform the following steps:

[0212] S1405, the first application sends a second request to the first TCP proxy server.

[0213] Correspondingly, the first proxy server receives the second request sent by the first application.

[0214] S1406, The first TCP proxy server generates a second message based on the second request.

[0215] The first TCP proxy server generates a second message based on the second request. The second message includes a second TCP proxy header and a second payload. The second TCP proxy header includes a second type field and a second index field. The second type field is used to indicate the type of the second message, and the second index field is used to indicate the connection between the first application and the first TCP proxy server. The second type field is the same as the first type field, and the second index field is the same as the first index field.

[0216] S1407, the first TCP proxy server sends the second message to the NAS device.

[0217] S1408, the NAS device sends the second payload to the first port according to the second message so that the second payload is sent to the application service corresponding to the second payload.

[0218] It should be understood that the descriptions of S1405-S1408 can be found in the descriptions of S1401-S1404, and for the sake of brevity, they will not be repeated here.

[0219] Optionally, in some embodiments, the first electronic device includes a control module. Before sending the first message and the second message to the NAS device, the first proxy server may send the first message and the second message to the control module. The control module determines the sending order of the first message and the second message based on the first message and the second message, and then sends the first message and the second message according to the determined sending order.

[0220] It should be understood that the description of how the control module determines the message sending order can be found above, and will not be repeated here for the sake of brevity.

[0221] Optionally, in some embodiments, the first TCP proxy header may further include a first length field and / or a first reservation field. For a description of the length field and the reservation field, please refer to the above text, and for the sake of brevity, it will not be repeated here.

[0222] In this embodiment, by creating a TCP proxy service between the electronic device and the NAS device and customizing the TCP proxy header, the electronic device can remotely or locally access the NAS device. The electronic device can remotely access the NAS device without enabling the VPN service, without affecting other services of the electronic device in creating the VPN service. Furthermore, the electronic device can control the order of message transmission, ensuring that messages of the same type are sent simultaneously.

[0223] In some embodiments, such as Figure 15 The illustrated embodiment of this application provides a system interaction diagram. The first electronic device further includes a second TCP proxy server. The port of the second TCP proxy server corresponds to the second port of the virtual server in the NAS device. The system can also perform the following steps:

[0224] S1409, the first application sends a third request to the second TCP proxy server.

[0225] Correspondingly, the second TCP proxy server receives the third request sent by the first application.

[0226] S1410, the second TCP proxy server generates a third message based on the third request.

[0227] The second TCP proxy server generates a third message based on the third request. The third message includes a third TCP proxy header and a third payload. The third TCP proxy header includes a third type field and a third index field. The third type field is used to indicate the type of the third message, and the third index field is used to indicate the connection between the first application and the second TCP proxy server.

[0228] S1411, the second TCP proxy server sends a third message to the NAS device.

[0229] S1412, the NAS device sends the third payload to the second port according to the third message, so as to send the third payload to the application service corresponding to the third payload.

[0230] After receiving the third packet, the NAS device can parse the third TCP proxy header of the third packet. The port can be determined from the third type field. The third payload can then be sent to the second port of the virtual server in the NAS device, so that the virtual server in the NAS device will send the third payload to the application service corresponding to the third payload, thereby enabling electronic devices to access the NAS device.

[0231] In some embodiments, such as Figure 16 The illustrated embodiment of this application provides a system interaction diagram. The first electronic device further includes a second application, and the system can be used to perform the following steps:

[0232] S1413, the second application sends a fourth request to the first TCP proxy server.

[0233] Correspondingly, the first TCP proxy server receives the fourth request sent by the second application.

[0234] S1414, the first TCP proxy server generates the fourth message based on the fourth request.

[0235] The first TCP proxy server generates a fourth message based on the fourth request. The fourth message includes a fourth TCP proxy header and a fourth payload. The fourth TCP proxy header includes a fourth type field and a fourth index field. The fourth type field is used to indicate the type of the fourth message, and the fourth index field is used to indicate the connection between the second application and the first TCP proxy server. The fourth type field is the same as the first type field, and the fourth index field is different from the first index field.

[0236] S1415, the first TCP proxy server sends the fourth message to the NAS device.

[0237] S1416, the NAS device sends the fourth payload to the first port according to the fourth message so that the fourth payload is sent to the application service corresponding to the fourth payload.

[0238] After receiving the fourth packet, the NAS device can parse the fourth TCP proxy header of the fourth packet. The port can be determined from the fourth type field. The fourth payload can then be sent to the first port of the NAS so that the virtual server in the NAS device can send the fourth payload to the application service corresponding to the fourth payload, thereby enabling electronic devices to access the NAS device.

[0239] In some embodiments, such as Figure 17 The illustrated embodiment of this application provides a system interaction diagram. The first electronic device further includes a second application and a second TCP proxy server. This system can be used to perform the following steps:

[0240] S1417, the second application sends a fifth request to the second TCP proxy server.

[0241] Correspondingly, the second TCP proxy server receives the fifth request sent by the second application.

[0242] S1418, the second TCP proxy server generates the fifth message based on the fifth request.

[0243] The second TCP proxy server generates a fifth message based on the fifth request. The fifth message includes a fifth TCP proxy header and a fifth payload. The fifth TCP proxy header includes a fifth type field and a fifth index field. The fifth type field is used to indicate the type of the fifth message, and the fifth index field is used to indicate the connection between the second application and the second TCP proxy server. The fifth type field is different from the first type field, and the fifth index field is different from the first index field.

[0244] S1419, the second TCP proxy server sends the fifth message to the NAS device.

[0245] S1420, the NAS device sends the fifth payload to the second port according to the fifth message, so as to send the fifth payload to the application service corresponding to the fifth payload.

[0246] After receiving the fifth packet, the NAS device can parse the fifth TCP proxy header of the fifth packet. The port can be determined from the fifth type field. The fifth payload can then be sent to the second port of the NAS so that the virtual server in the NAS device can send the fifth payload to the application service corresponding to the fifth payload, thereby enabling electronic devices to access the NAS device.

[0247] In some embodiments, such as Figure 18 The illustrated embodiment of this application provides a system interaction diagram. The system further includes a second electronic device that establishes a TCP proxy with the NAS device. The second electronic device includes a third TCP proxy server and a third application. The port of the third TCP proxy server corresponds to the third port of the virtual server in the NAS device. The first TCP proxy header also includes a first session field, which is used to indicate the session identifier between the first electronic device and the NAS device. The system can be used to perform the following steps:

[0248] S1421, the third application sends a sixth request to the third TCP proxy server.

[0249] Correspondingly, the third TCP proxy server receives the sixth request sent by the third application.

[0250] S1422, The third TCP proxy server generates the sixth message based on the sixth request.

[0251] The third TCP proxy server generates a sixth message based on the sixth request. The sixth message includes a sixth TCP proxy header and a sixth payload. The sixth TCP proxy header includes a sixth type field, a sixth index field, and a second session field. The sixth type field is used to indicate the type of the sixth message, and the sixth index field is used to indicate the connection between the third application and the third TCP proxy server. The sixth index field is different from the first index field, and the second session field is different from the first session field.

[0252] S1423, the third TCP proxy server sends the sixth message to the NAS device.

[0253] S1424, the NAS device sends the sixth payload to the third port according to the sixth message in order to send the sixth payload to the application service corresponding to the sixth payload.

[0254] After receiving the sixth packet, the NAS device can parse the sixth TCP proxy header of the sixth packet. The port can be determined from the sixth type field. The sixth payload can then be sent to the third port of the NAS so that the virtual server in the NAS device can send the sixth payload to the application service corresponding to the sixth payload, thereby enabling electronic devices to access the NAS device.

[0255] It is understandable that if the port of the third TCP proxy server is the same as the port of the first proxy server, then the first port and the third port are the same.

[0256] The foregoing primarily describes the method for accessing a NAS device provided in this application from the perspective of electronic devices and NAS devices. It is understood that, in order to achieve the above functions, electronic devices and NAS devices include corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0257] This application embodiment can divide the processor in electronic devices and NAS devices into functional modules according to the above method examples. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0258] This application also provides an electronic device, including a processor, a memory, an application program, and a computer program. The aforementioned devices can be connected via one or more communication buses. The one or more computer programs are stored in the memory and configured to be executed by the one or more processors. The one or more computer programs include instructions that can be used to cause the electronic device to perform various steps of the various electronic devices described in the above embodiments.

[0259] For example, the processor described above can specifically be Figure 3 The processor 310 shown above, the memory mentioned above can specifically be... Figure 3 The internal memory 320 shown and / or the external memory connected to the electronic device.

[0260] This application also provides a NAS device, including a processor, a memory, an application program, and a computer program. The aforementioned devices can be connected via one or more communication buses. The one or more computer programs are stored in the memory and configured to be executed by the one or more processors. The one or more computer programs include instructions that can be used to cause the NAS device to perform various steps of the NAS device described in the above embodiments.

[0261] This application also provides a chip, which includes a processor and a communication interface. The communication interface is used to receive signals and transmit the signals to the processor. The processor processes the signals so that the method for accessing a NAS device as described in any of the possible implementations above is executed.

[0262] This embodiment also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the method for accessing the NAS device in the above embodiment.

[0263] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the method for accessing the NAS device described in the above embodiment.

[0264] As used in the above embodiments, depending on the context, the terms "when..." or "after..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrases "when..." or "if (the stated condition or event) is detected" can be interpreted as meaning "if...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".

[0265] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0266] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0267] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0268] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0269] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0270] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0271] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for accessing a Network Attached Storage (NAS) device, characterized in that, The method is applied to a NAS device, and the method includes: The first message is received from a first electronic device, wherein the NAS device establishes a Transmission Control Protocol (TCP) proxy with the first electronic device. The first message is generated and sent by the first TCP proxy server of the first electronic device according to a first request. The first request is sent by the first application of the first electronic device to the first TCP proxy server. The port of the first TCP proxy server corresponds to the first port of the virtual server in the NAS device. The first message includes a first TCP proxy header and a first payload. The first TCP proxy header includes a first type field and a first index field. The first type field is used to indicate the type of the first message, and the first index field is used to indicate the connection between the first application and the first TCP proxy server. The first payload is sent to the first port of the virtual server in the NAS device according to the first message, so that the virtual server in the NAS device sends the first payload to the application service corresponding to the first payload.

2. The method according to claim 1, characterized in that, The method further includes: The system receives a second message sent by the first electronic device. The second message is generated and sent by the first TCP proxy server according to a second request. The second request is sent by the first application to the first TCP proxy server. The second message includes a second TCP proxy header and a second payload. The second TCP proxy header includes a second type field and a second index field. The second type field is used to indicate the type of the second message, and the second index field is used to indicate the connection between the first application and the first TCP proxy server. The second payload is sent to the first port of the virtual server in the NAS device according to the second message, so that the virtual server in the NAS device sends the second payload to the application service corresponding to the second payload.

3. The method according to claim 1 or 2, characterized in that, The first electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device, and the method further includes: The system receives a third message sent by the first electronic device. The third message is generated and sent by the second TCP proxy server according to a third request. The third request is sent by the first application to the second TCP proxy server. The third message includes a third TCP proxy header and a third payload. The third TCP proxy header includes a third type field and a third index field. The third type field is used to indicate the type of the third message, and the third index field is used to indicate the connection between the first application and the second TCP proxy server. The third payload is sent to the second port of the virtual server in the NAS device according to the third message, so that the virtual server in the NAS device sends the third payload to the application service corresponding to the third payload.

4. The method according to any one of claims 1 to 3, characterized in that, The first electronic device further includes a second application, and the method further includes: The system receives a fourth message sent by the first electronic device. The fourth message is generated and sent by the first TCP proxy server according to a fourth request. The fourth request is sent by the second application to the first TCP proxy server. The fourth message includes a fourth TCP proxy header and a fourth payload. The fourth TCP proxy header includes a fourth type field and a fourth index field. The fourth type field is used to indicate the type of the fourth message, and the fourth index field is used to indicate the connection between the second application and the first TCP proxy server. The fourth payload is sent to the first port of the virtual server in the NAS device according to the fourth message, so that the virtual server in the NAS device sends the fourth payload to the application service corresponding to the fourth payload.

5. The method according to claim 4, characterized in that, The first electronic device further includes a second TCP proxy server, which corresponds to a second port of the virtual server in the NAS device. The method further includes: The system receives a fifth message sent by the first electronic device. The fifth message is generated and sent by the second TCP proxy server according to a fifth request. The fifth request is sent by the second application to the second TCP proxy server. The fifth message includes a fifth TCP proxy header and a fifth payload. The fifth TCP proxy header includes a fifth type field and a fifth index field. The fifth type field is used to indicate the type of the fifth message, and the fifth index field is used to indicate the connection between the second application and the second TCP proxy server. The fifth payload is sent to the second port of the virtual server in the NAS device according to the fifth message, so that the virtual server in the NAS device sends the fifth payload to the application service corresponding to the fifth payload.

6. The method according to any one of claims 1 to 5, characterized in that, The first TCP proxy header further includes a first session field, which is used to indicate the session identifier between the first electronic device and the NAS device. The method further includes: The system receives a sixth message sent by a second electronic device, wherein the NAS device establishes a TCP proxy with the second electronic device, the sixth message is generated and sent by the third TCP proxy server of the second electronic device according to a sixth request, the sixth request is sent by the third application of the second electronic device to the third TCP proxy server, the port of the third TCP proxy server corresponds to the third port of the virtual server in the NAS device, the sixth message includes a sixth TCP proxy header and a sixth payload, the sixth TCP proxy header includes a sixth type field, a sixth index field and a second session field, the sixth type field is used to indicate the type of the sixth message, and the sixth index field is used to indicate the connection between the third application and the third TCP proxy server; The sixth payload is sent to the third port of the virtual server in the NAS device according to the sixth message, so that the virtual server in the NAS device sends the sixth payload to the application service corresponding to the sixth payload.

7. The method according to any one of claims 1 to 6, characterized in that, The first TCP proxy header also includes a first length field, which is used to indicate the length of the first payload.

8. A method for accessing a network attached storage (NAS) device, characterized in that, The method is applied to an electronic device, wherein the electronic device and the NAS device establish a TCP proxy, the electronic device includes a first TCP proxy server and a first application, and the port of the first TCP proxy server corresponds to the first port of the virtual server in the NAS device, the method comprising: The first application is configured to send a first request to the first TCP proxy server; The first TCP proxy server is configured to generate a first message according to the first request. The first message includes a first TCP proxy header and a first payload. The first TCP proxy header includes a first type field and a first index field. The first type field is used to indicate the type of the first message, and the first index field is used to indicate the connection between the first application and the first TCP proxy server. The first TCP proxy server is also configured to send the first message to the NAS device to enable the electronic device to access the NAS device.

9. The method according to claim 8, characterized in that, The method further includes: The first application is also configured to send a second request to the first TCP proxy server; The first TCP proxy server is further configured to generate a second message according to the second request. The second message includes a second TCP proxy header and a second payload. The second TCP proxy header includes a second type field and a second index field. The second type field is used to indicate the type of the second message, and the second index field is used to indicate the connection between the first application and the first TCP proxy server. The first TCP proxy server is also configured to send the second message to the NAS device to enable the electronic device to access the NAS device.

10. The method according to claim 8 or 9, characterized in that, The electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The method further includes: The first application is also used to send a third request to the second TCP proxy server; The second TCP proxy server is configured to generate a third message based on the third request. The third message includes a third TCP proxy header and a third payload. The third TCP proxy header includes a third type field and a third index field. The third type field is used to indicate the type of the third message, and the third index field is used to indicate the connection between the first application and the second TCP proxy server. The second TCP proxy server is also used to send the third message to the NAS device to enable the electronic device to access the NAS device.

11. The method according to any one of claims 8 to 10, characterized in that, The electronic device also includes a second application, and the method further includes: The second application is also used to send a fourth request to the first TCP proxy server; The first TCP proxy server is further configured to generate a fourth message according to the fourth request. The fourth message includes a fourth TCP proxy header and a fourth payload. The fourth TCP proxy header includes a fourth type field and a fourth index field. The fourth type field is used to indicate the type of the fourth message, and the fourth index field is used to indicate the connection between the second application and the first TCP proxy server. The first TCP proxy server is also configured to send the fourth message to the NAS device to enable the electronic device to access the NAS device.

12. The method according to claim 11, characterized in that, The electronic device further includes a second TCP proxy server, the port of which corresponds to the second port of the virtual server in the NAS device. The method further includes: The second application is also used to send a fifth request to the second TCP proxy server; The second TCP proxy server is further configured to generate a fifth message according to the fifth request. The fifth message includes a fifth TCP proxy header and a fifth payload. The fifth TCP proxy header includes a fifth type field and a fifth index field. The fifth type field is used to indicate the type of the fifth message, and the fifth index field is used to indicate the connection between the second application and the second TCP proxy server. The second TCP proxy server is also used to send the fifth message to the NAS device to enable the electronic device to access the NAS device.

13. The method according to claim 9, characterized in that, The electronic device further includes a control module, wherein the first TCP server is specifically configured to: send the first message and the second message to the control module; The control module is used to determine the sending order of the first message and the second message; The control module is further configured to send the first message and the second message to the NAS device according to a predetermined sending order so that the electronic device can access the NAS device.

14. The method according to any one of claims 8 to 13, characterized in that, The first TCP proxy header also includes a first length field and / or a first session field, wherein the first length field is used to indicate the length of the first payload and the first session field is used to indicate the session identifier between the electronic device and the NAS device.

15. A network-attached storage (NAS) device, characterized in that, It includes one or more processors; one or more memories; said one or more memories storing one or more computer programs, said one or more computer programs including instructions that, when executed by said one or more processors, cause the method of any one of claims 1 to 7 to be performed.

16. An electronic device, characterized in that, It includes one or more processors; one or more memories; said one or more memories storing one or more computer programs, said one or more computer programs including instructions that, when executed by said one or more processors, cause the method of any one of claims 8 to 14 to be performed.

17. A system for accessing a Network Attached Storage (NAS) device, characterized in that, Includes the network-attached storage device as described in claim 15 and the electronic device as described in claim 16.

18. A chip, characterized in that, The chip includes a processor and a communication interface, the communication interface being used to receive signals and transmit the signals to the processor, the processor processing the signals such that the method as described in any one of claims 1 to 7 or 8 to 14 is executed.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the method as described in any one of claims 1 to 7 or 8 to 14 to be performed.

20. A computer program product containing instructions, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the method as described in any one of claims 1 to 7 or 8 to 14.

Citation Information

Patent Citations

  • System and method for generating network cloud-based supports for area, domestic and international UAV system

    CN105227631A

  • Communication method and device

    CN111031078A