Data sharing method, electronic equipment and storage medium

The data sharing method enhances device-to-device communication by using mDNS and socket connections to facilitate efficient resource discovery and access, addressing inefficiencies in current file sharing methods.

CN119094516APending Publication Date: 2024-12-06NIO TECH ANHUI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411198634.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Current methods for file sharing between devices within a domain network are inefficient, relying on social software which results in low sharing efficiency and fails to meet actual needs.

Method used

A data sharing method involving sending sharing service information to a preset address, acquiring service information from that address, and establishing a communication connection between devices using multicast DNS (mDNS) and socket objects to facilitate efficient data sharing.

Benefits of technology

Enables smart devices to quickly discover shared resources, improving data sharing efficiency by allowing direct communication and resource access without reliance on external DNS servers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094516A_ABST
    Figure CN119094516A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, particularly provides a data sharing method, electronic equipment and a storage medium, and aims to solve the technical problem that file sharing between equipment in a current domain network is relatively difficult. In order to achieve the purpose, the data sharing method comprises the steps that first sharing service information is sent to a preset address; acquiring second shared service information from the preset address; and establishing a communication connection between the first device and the second device based on the first sharing service information and the second sharing service information to realize data sharing between the first device and the second device. Therefore, the intelligent equipment in the computer network can find shared resources of other intelligent equipment more quickly, so that the problem that data access between the equipment is difficult is solved, and the data sharing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and specifically provides a data sharing method, electronic equipment and storage medium. Background Art

[0002] With the development of computer technology, different terminal devices are installed with multiple applications. These applications will generate business data when running. Business data needs to be shared between different devices according to business needs.

[0003] Currently, file sharing between devices within a domain network is difficult. The common way of sharing is to send files to the other party's device through various social software, which results in low sharing efficiency and cannot meet actual needs.

[0004] Accordingly, the art needs a new data sharing solution to solve the above problems.

[0005] Application Contents

[0006] In order to overcome the above defects, the present application is proposed to provide a solution or at least partially solve the above technical problems. The present application provides a data sharing method, an electronic device and a storage medium.

[0007] In a first aspect, the present application provides a data sharing method, applied to a first device, the method comprising:

[0008] Sending the first sharing service information to a preset address;

[0009] Acquire second shared service information from the preset address, where the second shared service information is shared service information of the second device;

[0010] A communication connection is established between the first device and the second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device.

[0011] In one embodiment of the present application, before sending the first sharing service information to the preset address, the method further includes:

[0012] Creating a first sharing service based on a first operation instruction, where the first operation instruction is an operation instruction of a user on the first device;

[0013] The first sharing service information is sent by the first sharing service to a preset address.

[0014] In one embodiment of the present application, the preset address is a multicast address; the sending of the first sharing service information to the preset address by the first sharing service includes: the first sharing service sending the first sharing service information to the multicast address using the mDNS protocol.

[0015] In one implementation of the present application, establishing a communication connection between the first device and the second device based on the first shared service information and the second shared service information includes:

[0016] Create a socket object;

[0017] sending a connection request to a second device based on the socket object, wherein the connection request is generated based on the first shared service information and the second shared service information;

[0018] receiving a connection response, the connection response being a response sent by the second device in response to the connection request;

[0019] A communication connection is established between the first device and the second device based on the connection response.

[0020] In one embodiment of the present application, the first shared service information and the second shared service information both include an IP address and a service port; determining the connection request based on the first shared service information and the second shared service information includes: determining the connection request based on the IP address and the service port.

[0021] In one embodiment of the present application, the method further includes:

[0022] receiving, via the communication connection, a first data sharing request sent by the second device;

[0023] In response to the first data sharing request, first shared data is sent to the second device.

[0024] In one embodiment of the present application, the method further includes:

[0025] sending a second data sharing request to the second device via the communication connection;

[0026] The second shared data sent by the second device in response to the second data sharing request is received.

[0027] In a second aspect, the present application provides a data sharing method, applied to a second device, the method comprising:

[0028] receiving first sharing service information and a connection request;

[0029] verifying the connection request based on the first shared service information and the second shared service information;

[0030] When the connection request is verified successfully, a connection response is sent to the first device.

[0031] In one embodiment of the present application, the method further includes:

[0032] sending a first data sharing request to the first device via the communication connection;

[0033] The first shared data sent by the first device in response to the first data sharing request is received.

[0034] In one embodiment of the present application, the method further includes:

[0035] receiving, via the communication connection, a second data sharing request sent by the first device;

[0036] In response to the second data sharing request, second shared data is sent to the first device.

[0037] In a third aspect, an electronic device is provided, which includes at least one processor and at least one memory, wherein the memory is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute any of the data sharing methods described above.

[0038] In a fourth aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored in the computer-readable storage medium, wherein the program codes are suitable for being loaded and run by a processor to execute any of the aforementioned data sharing methods.

[0039] Solution 1. A data sharing method, applied to a first device, characterized in that the method comprises:

[0040] Sending the first sharing service information to a preset address;

[0041] Acquire second shared service information from the preset address, where the second shared service information is shared service information of the second device;

[0042] A communication connection is established between the first device and the second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device.

[0043] Solution 2. The data sharing method according to Solution 1 is characterized in that before sending the first sharing service information to the preset address, the method further comprises:

[0044] Creating a first sharing service based on a first operation instruction, where the first operation instruction is an operation instruction of a user on the first device;

[0045] The first sharing service information is sent by the first sharing service to a preset address.

[0046] Solution 3. The data sharing method according to Solution 2 is characterized in that the preset address is a multicast address; and sending the first sharing service information to the preset address includes: the first sharing service uses the mDNS protocol to send the first sharing service information to the multicast address.

[0047] Solution 4. The data sharing method according to Solution 1, characterized in that establishing a communication connection between the first device and the second device based on the first sharing service information and the second sharing service information comprises:

[0048] Create a socket object;

[0049] sending a connection request to a second device based on the socket object, wherein the connection request is generated based on the first shared service information and the second shared service information;

[0050] receiving a connection response, the connection response being a response sent by the second device in response to the connection request;

[0051] A communication connection is established between the first device and the second device based on the connection response.

[0052] Solution 5. The data sharing method according to Solution 4 is characterized in that the first sharing service information and the second sharing service information both include an IP address and a service port;

[0053] The determining the connection request based on the first shared service information and the second shared service information includes: determining the connection request based on the IP address and the service port.

[0054] Solution 6. The data sharing method according to Solution 1, characterized in that the method further comprises:

[0055] receiving, via the communication connection, a first data sharing request sent by the second device;

[0056] In response to the first data sharing request, first shared data is sent to the second device.

[0057] Solution 7. The data sharing method according to Solution 1, characterized in that the method further comprises:

[0058] sending a second data sharing request to the second device via the communication connection;

[0059] The second shared data sent by the second device in response to the second data sharing request is received.

[0060] Solution 8. A data sharing method, applied to a second device, characterized in that the method comprises:

[0061] receiving first sharing service information and a connection request;

[0062] verifying the connection request based on the first shared service information and the second shared service information;

[0063] When the connection request is verified successfully, a connection response is sent to the first device.

[0064] Solution 9. The data sharing method according to Solution 8, characterized in that the method further comprises:

[0065] sending a first data sharing request to the first device via a communication connection;

[0066] The first shared data sent by the first device in response to the first data sharing request is received.

[0067] Solution 10. The data sharing method according to Solution 8, characterized in that the method further comprises:

[0068] receiving, via the communication connection, a second data sharing request sent by the first device;

[0069] In response to the second data sharing request, second shared data is sent to the first device.

[0070] Scheme 11. An electronic device comprising at least one processor and at least one memory, wherein the memory is suitable for storing multiple program codes, and wherein the program codes are suitable for being loaded and run by the processor to execute the data sharing method described in any one of Schemes 1 to 7, or to execute the data sharing method described in Schemes 8-10.

[0071] Scheme 12. A computer-readable storage medium storing a plurality of program codes, characterized in that the program codes are suitable for being loaded and run by a processor to execute the data sharing method described in any one of Schemes 1 to 7, or to execute the data sharing method described in Schemes 8-10.

[0072] The above one or more technical solutions of the present application have at least one or more of the following beneficial effects:

[0073] The data sharing method in the present application specifically includes: sending first sharing service information to a preset address; obtaining second sharing service information from the preset address; establishing a communication connection between a first device and a second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device. In this way, the smart devices in the computer network can more quickly discover the shared resources of other smart devices, thereby solving the problem of difficulty in accessing data between devices and improving data sharing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The disclosure of the present application will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present application. In addition, similar numbers in the drawings are used to represent similar components, among which:

[0075] Figure 1 It is a flowchart of the main steps of a data sharing method according to an embodiment of the present application;

[0076] Figure 2 is a flowchart of main steps of a data sharing method according to another embodiment of the present application;

[0077] Figure 3 is a flowchart of main steps of a data sharing method according to another embodiment of the present application;

[0078] Figure 4 is a complete flow chart of a data sharing method according to an embodiment of the present application;

[0079] Figure 5 It is a schematic diagram of the structure of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION

[0080] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.

[0081] In the description of the present application, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, memory, and may also include software parts, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program code, such as a disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and may include only A, only B or A and B. The singular terms "one" and "the" may also include plural forms.

[0082] Currently, file sharing between devices within a domain network is difficult. The common way of sharing is to send files to the other party's device through various social software, which results in low sharing efficiency and cannot meet actual needs.

[0083] To this end, the present application proposes a data sharing method, electronic device and storage medium, which specifically include: sending first sharing service information to a preset address; obtaining second sharing service information from the preset address; establishing a communication connection between the first device and the second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device. In this way, the smart devices in the computer network can more quickly discover the shared resources of other smart devices, thereby solving the problem of difficult data access between devices and improving data sharing efficiency.

[0084] The first device and the second device in the present application are both smart devices. For example, a user's mobile phone and a vehicle (such as a smart cockpit of a vehicle) can be respectively used as an example of the first device and the second device, but are not limited thereto.

[0085] See attached Figure 1 , Figure 1 It is a flowchart of the main steps of a data sharing method according to an embodiment of the present application.

[0086] like Figure 1 As shown, the data sharing method in the embodiment of the present application mainly includes the following steps S101 to S103.

[0087] Step S101: Sending first sharing service information to a preset address.

[0088] The preset address may be a preset network address, wherein the network address is mainly divided into unicast address, multicast address, broadcast address, anycast address, loopback address and other unspecified addresses according to function and purpose.

[0089] Specifically, before sending the first shared service information to the preset address, the preset address should be acquired.

[0090] In a specific embodiment of the present application, before sending the first sharing service information to a preset address, the method also includes: creating a first sharing service based on a first operation instruction, the first operation instruction being an operation instruction of a user on the first device; and sending the first sharing service information to a preset address by the first sharing service.

[0091] The first operation instruction may be an operation instruction for the user to open a shared application (first shared application) on the first device.

[0092] Specifically, when the user opens the sharing application on the first device, the application will initialize the internal sharing module. During this process, the application configures local resources (such as a specified folder or a specific type of network service), sets corresponding access permissions, starts a service process that listens to a specific port, and creates a first sharing service, preparing to provide shared content to the outside world.

[0093] The first shared service refers to resources or functions provided by the first device or an application of the first device, such as sharing folders, printer services, application services, etc. within a local area network, so that other devices within the network can access and use these resources.

[0094] The first sharing service serves as a sharing service information transmission medium between the first sharing application and the second sharing application, and is responsible for sending the first sharing service information to a preset address.

[0095] Step S102: Acquire second sharing service information from the preset address, where the second sharing service information is sharing service information of the second device.

[0096] The second device is any other device in the computer network where the first device is located except the first device.

[0097] When the user opens the sharing application on the second device, the program will initialize the internal sharing module. During this process, the application configures local resources (such as a specified folder or a specific type of network service), sets corresponding access permissions, starts a service process that listens to a specific port, and creates a second sharing service, preparing to provide shared content to the outside world.

[0098] The second sharing service is a service model in which the second device opens its resources (such as files, printers, databases, etc.) to the outside world by running a specific sharing application in a computer network environment, so that other devices in the same network environment can access and use these resources through network protocols.

[0099] In addition to sending the first shared service information to the preset address, the first device may also obtain shared service information of other devices from the preset address, such as a shared service message of the second device.

[0100] Step S103: establishing a communication connection between the first device and the second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device.

[0101] Computer networks include local area networks, wide area networks, metropolitan area networks, and wireless local area networks, etc. By way of example, a local area network can be used as an example of a computer network in the present application.

[0102] Specifically, after the second device obtains the first shared service information from the preset address, a communication connection is established between the first device and the second device.

[0103] After a first device and a second device in a computer network establish a communication connection, data sharing of the first device with data of the second device can be achieved based on the communication connection, and data sharing between the first device and the second device can also be achieved.

[0104] Based on the above steps S101 to S103, firstly, the first sharing service information is sent to the preset address; the second sharing service information is obtained from the preset address; based on the first sharing service information and the second sharing service information, a communication connection is established between the first device and the second device to realize data sharing between the first device and the second device. In this way, the smart devices in the computer network can more quickly discover the shared resources of other smart devices, thereby solving the problem of difficult data access between devices and improving data sharing efficiency.

[0105] The above steps S102 to S103 are further explained below.

[0106] For step S102, in a specific implementation of the present application, the preset address is a multicast address; the sending of the first sharing service information to the preset address by the first sharing service includes: the first sharing service sending the first sharing service information to the multicast address using the mDNS protocol.

[0107] The first shared service information includes the service type, service name, IP address and port number of the first shared service.

[0108] The service type is used to identify the type of service provided by the first device, such as HTTP service, FTP service, SSH service, etc. When other devices search for or connect to the shared service of the first device, they will decide which protocol or method to use for connection according to the service type.

[0109] The service name helps the second device to identify and select a specific service instance from among many services. In particular, in a service discovery mechanism such as mDNS, the second device can find a specific service provided by the first device according to the service name.

[0110] The IP address is the unique identifier of a device in the network. The second device must know the IP address of the first device to establish a socket connection. In the TCP / IP protocol stack, the socket connection must specify the IP address of the other host so that the data packet can be accurately delivered to the destination.

[0111] The port number is the identifier of a specific service running on a device. Each service occupies a specific port number on the host. When device 2 establishes a socket connection with device 1, in addition to the IP address, it also needs to know the port number that the service on device 1 listens to, so as to ensure that the data packet can be correctly delivered to the service process.

[0112] The second sharing service information includes the service type, service name, IP address and port number of the second sharing service.

[0113] mDNS (Multicast DNS) is a network protocol that allows devices to automatically discover and resolve service names to IP addresses in a local network (such as a LAN) without a traditional DNS server. By using multicast technology, mDNS enables devices in the network to broadcast their own service information and discover other services in the same subnet. mDNS can implement functions such as AirPlay and Bonjour service automatic discovery.

[0114] Specifically, when a first shared service supporting mDNS is created, the first shared service encapsulates the service type, service name, IP address, and port number into an mDNS message, and sends the message to a specific multicast address.

[0115] The multicast address includes any one of IPv4 and IPv6, where the IPv4 address is 224.0.0.251 and the IPv6 address is FF02::FB.

[0116] Other devices in the same network listen to these multicast messages from the multicast address to identify available service resources. They can discover various services in the network by listening to mDNS traffic on the same multicast address.

[0117] The above is a further description of step S102 , and the following is a further description of step S103 .

[0118] With respect to step S103, after receiving the shared service information from the preset network address, other devices in the same network can resolve the device name providing the service and its corresponding IP address without relying on an external DNS server, so that they can communicate directly with the device.

[0119] Once the second device determines the detailed information of the target service (the first shared service of the first device), it can use the obtained IP address and port number to send a request to establish a communication connection to the shared application of the first device. After the shared application of the first device receives the request, a communication connection is established between the shared application of the first device and the shared application of the second device. Specifically, the above step S103 can be implemented through the following steps S1031-S1034.

[0120] Step S1031: Create a socket object.

[0121] A socket object is an abstract interface provided by the operating system for applications to implement network communication. In essence, it is an endpoint for network communication. Through the socket object, applications can send and receive network data, and implement service requests, data transmission, and responses between different hosts.

[0122] Specifically, a socket object is created by a sharing application on the first device through a programming interface.

[0123] Step S1032: Send a connection request to the second device based on the socket object, wherein the connection request is generated based on the first shared service information and the second shared service information.

[0124] In a specific implementation of the present application, the first shared service information and the second shared service information both include an IP address and a service port; determining the connection request based on the first shared service information and the second shared service information includes: determining the connection request based on the IP address and the service port.

[0125] Specifically, a connection request is generated through the IP address of the first device, the service port of the application on the first device, the IP address of the second device, and the service port of the application on the second device.

[0126] Specifically, the application on the first device sends a connection request to the second device through the created socket object according to the IP address of the first device, the port number of the first device, the IP address of the second device and the port number of the second device. This request is transmitted in the form of a data packet in the network and contains information such as the source address, destination address, port number, etc.

[0127] Step S1033: Receive a connection response, where the connection response is a response sent by the second device in response to the connection request.

[0128] Specifically, after receiving the connection request, the second device verifies whether the connection request is legal based on the first shared service information obtained from the preset address and the second shared service information, such as checking the format of the request, the IP address of the first device, etc.; if legal, a connection response is sent to the first device.

[0129] Step S1034: Establish a communication connection between the first device and the second device based on the connection response.

[0130] Once the first device accepts the connection response, a two-way communication channel will be established between the first device and the second device, so that both parties can send and receive data through the established socket connection, forming a two-way communication link. In the file sharing scenario, the first device can request and receive files through this link, and the second device can also send and confirm the file transfer status through this link.

[0131] In a specific implementation of the present application, the method further includes: receiving a first data sharing request sent by the second device via the communication connection; and sending first shared data to the second device in response to the first data sharing request.

[0132] The first shared data refers to the actual data returned according to the file operation involved in the content of the first data sharing request after the first device receives the first data sharing request. For example, if the request is to read a file, the first shared data is the content of the requested file; if the request is a write operation, the first shared data may be response information confirming the success of the write or some status data that may be involved in the write process.

[0133] Specifically, the second device can send a first data sharing request to the first device through a communication connection channel according to a preset file transfer protocol (such as HTTP, FTP, SMB, etc.), including information such as the file path to be accessed and the operation type (read or write). After receiving the first data sharing request, the first device performs a corresponding operation and returns the data content to the second device through the established communication connection, thereby realizing efficient sharing of the data of the first device with the second device.

[0134] In another specific implementation of the present application, the method further includes: sending a second data sharing request to the second device via the communication connection; and receiving second shared data sent by the second device in response to the second data sharing request.

[0135] Specifically, the first device can also send a second data sharing request to the second device. After receiving the second data sharing request, the second device performs corresponding operations and returns the data content to the first device through the established communication connection. In this way, efficient sharing of the data of the second device with the first device is achieved.

[0136] The present application provides a method for sharing data between smart devices in a domain network. By using the service discovery technology in the domain network, smart devices in the domain network can easily discover shared resources of other smart devices, thereby solving the problem of difficult data access between devices and improving data sharing efficiency.

[0137] Further, if Figure 2 As shown, the present application also provides a data sharing method, which is specifically implemented through the following steps S201 to S203.

[0138] Step S201: receiving first sharing service information and a connection request.

[0139] Specifically, the second device obtains the first shared service information from a preset address through the mDNS technology, and receives a connection request sent by the first device.

[0140] Step S202: verifying the connection request based on the first shared service information and the second shared service information.

[0141] Specifically, the second device verifies whether the connection request is legitimate according to the first sharing service information and the second sharing service information, specifically, verifies whether the content of the connection request is consistent with the first sharing service information and the second sharing service information.

[0142] Step S203: When the connection request verification is successful, a connection response is sent to the first device.

[0143] Specifically, after verifying that the connection request is legitimate, the second device sends a connection response to the first device.

[0144] The data sharing method in the present application first receives the first sharing service information and the connection request, verifies the connection request based on the first sharing service information and the second sharing service information, and thereby establishes a communication connection between the first device and the second device if the verification is successful. In this way, secure data sharing between the first device and the second device can be achieved.

[0145] In a specific implementation of the present application, the method further includes: sending a first data sharing request to the first device via the communication connection; and receiving first shared data sent by the first device in response to the first data sharing request.

[0146] Specifically, the second device can send a first data sharing request to the first device through a communication connection channel according to a preset file transfer protocol (such as HTTP, FTP, SMB, etc.), including information such as the file path to be accessed and the operation type (read or write). After receiving the first data sharing request, the first device performs a corresponding operation and returns the data content to the second device through the established communication connection, thereby realizing efficient sharing of the data of the first device with the second device.

[0147] In a specific implementation of the present application, the method further includes: receiving a second data sharing request sent by the first device via the communication connection; and sending second shared data to the first device in response to the second data sharing request.

[0148] In addition, the second device can also receive the second data sharing request sent by the first device through the communication connection channel. After receiving the second data sharing request, the second device performs corresponding operations and returns the second shared data content to the first device through the established communication connection, thus realizing efficient sharing of the data of the second device with the first device.

[0149] Further, if Figure 3 As shown, the present application also provides a data sharing method, which is specifically implemented through the following steps S301 to S304.

[0150] Step S301: a first device creates a first sharing service based on a first operation instruction, where the first operation instruction is an operation instruction issued by a user to the first device.

[0151] Step S302: The first sharing service sends first sharing service information to a preset address.

[0152] Step S303: The second device receives the first sharing service information from the preset address.

[0153] Step S304: establishing a communication connection between the first device and the second device based on the first sharing service information and the second sharing service information, so as to share data between the first device and the second device based on the communication connection.

[0154] The data sharing method in this embodiment has the same implementation principle as the data sharing method in the aforementioned embodiment. The specific implementation principle of the data sharing method in this embodiment can be found in the implementation principle of the data sharing method in the aforementioned embodiment, which will not be repeated here.

[0155] Through the above-mentioned data sharing method between smart devices in the domain network, using the service discovery technology in the domain network, smart devices in the domain network can easily discover the shared resources of other smart devices, thereby solving the problem of difficult data access between devices, realizing data sharing between devices in the domain network, and improving data sharing efficiency.

[0156] The second sharing service acts as a medium for transmitting sharing service information between the second sharing application and the first sharing application, and is responsible for sending the second sharing service information to a preset address. Accordingly, the first device can obtain the service information of the second sharing service from the preset network address, and based on the communication connection between the applications established between the first device and the second device, the device data of the second device can be shared with the first device.

[0157] In a specific embodiment of the present application, Figure 4 As shown, first the user opens the sharing program on device 1 and creates a sharing service. Based on the mDNS technology, the local service sharing information is published to the multicast address, and the shared service information of other identified devices is obtained from the multicast address. Based on the obtained service information, a socket is used to connect to the service port of the other device. After the socket connection is established, data sharing between different devices in the domain network is realized by exchanging the data information to be shared, thereby improving the efficiency of data sharing.

[0158] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.

[0159] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0160] Furthermore, the present application also provides an electronic device. In an electronic device embodiment according to the present application, Figure 5 As shown, the electronic device includes at least one processor 41 and at least one memory 42, the memory 42 can be configured to store a program for executing the data sharing method of the above method embodiment, and the processor 41 can be configured to execute the program in the memory, which includes but is not limited to the program for executing the data sharing method of the above method embodiment. For ease of explanation, only the part related to the embodiment of the present application is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application.

[0161] In the embodiment of the present application, the electronic device may be a control device device including various devices. In some possible implementations, the electronic device may include multiple memories and multiple processors. The program for executing the data sharing method of the above method embodiment can be divided into multiple subprograms, each of which can be loaded and run by the processor to execute different steps of the data sharing method of the above method embodiment. Specifically, each subprogram can be stored in different memories, and each processor can be configured to execute programs in one or more memories to jointly implement the data sharing method of the above method embodiment, that is, each processor executes different steps of the data sharing method of the above method embodiment, to jointly implement the data sharing method of the above method embodiment.

[0162] The above-mentioned multiple processors may be processors deployed on the same device. For example, the above-mentioned electronic device may be a high-performance device composed of multiple processors, and the above-mentioned multiple processors may be processors configured on the high-performance device. In addition, the above-mentioned multiple processors may also be processors deployed on different devices. For example, the above-mentioned electronic device may be a server cluster, and the above-mentioned multiple processors may be processors on different servers in the server cluster.

[0163] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the data sharing method of the above method embodiment, and the program can be loaded and run by the processor to implement the above data sharing method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium can be a memory device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.

[0164] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.

[0165] The user personal information processed by this application will vary depending on the specific product / service scenario, and will be based on the specific scenario in which the user uses the product / service. It may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.

[0166] This application attaches great importance to the security of user personal information and has taken reasonable and feasible security protection measures that meet industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.

[0167] So far, the technical solutions of the present application have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.

Claims

1. A data sharing method, applied to a first device, characterized in that: The method comprises: Sending the first sharing service information to a preset address; Acquire second shared service information from the preset address, where the second shared service information is shared service information of the second device; A communication connection is established between the first device and the second device based on the first sharing service information and the second sharing service information to achieve data sharing between the first device and the second device.

2. The data sharing method according to claim 1, characterized in that: Before sending the first sharing service information to the preset address, the method further includes: Creating a first sharing service based on a first operation instruction, where the first operation instruction is an operation instruction of a user on the first device; The first sharing service information is sent by the first sharing service to a preset address.

3. The data sharing method according to claim 2, characterized in that: The preset address is a multicast address; sending the first sharing service information to the preset address includes: the first sharing service uses the mDNS protocol to send the first sharing service information to the multicast address.

4. The data sharing method according to claim 1, characterized in that: The establishing a communication connection between the first device and the second device based on the first shared service information and the second shared service information includes: Create a socket object; sending a connection request to a second device based on the socket object, wherein the connection request is generated based on the first shared service information and the second shared service information; receiving a connection response, the connection response being a response sent by the second device in response to the connection request; A communication connection is established between the first device and the second device based on the connection response.

5. The data sharing method according to claim 4, characterized in that: The first shared service information and the second shared service information both include an IP address and a service port; The determining the connection request based on the first shared service information and the second shared service information includes: determining the connection request based on the IP address and the service port.

6. The data sharing method according to claim 1, characterized in that: The method further comprises: receiving, via the communication connection, a first data sharing request sent by the second device; In response to the first data sharing request, first shared data is sent to the second device.

7. The data sharing method according to claim 1, characterized in that: The method further comprises: sending a second data sharing request to the second device via the communication connection; The second shared data sent by the second device in response to the second data sharing request is received.

8. A data sharing method, applied to a second device, characterized in that: The method comprises: receiving first sharing service information and a connection request; verifying the connection request based on the first shared service information and the second shared service information; When the connection request is verified successfully, a connection response is sent to the first device.

9. The data sharing method according to claim 8, characterized in that: The method further comprises: sending a first data sharing request to the first device via a communication connection; The first shared data sent by the first device in response to the first data sharing request is received.

10. The data sharing method according to claim 8, characterized in that: The method further comprises: receiving, via the communication connection, a second data sharing request sent by the first device; In response to the second data sharing request, second shared data is sent to the first device.