CN113141582B - Log export method and device, computer equipment and storage medium - Google Patents

Log export method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113141582B
CN113141582B CN202110447896.8A CN202110447896A CN113141582B CN 113141582 B CN113141582 B CN 113141582B CN 202110447896 A CN202110447896 A CN 202110447896A CN 113141582 B CN113141582 B CN 113141582B
Authority
CN
China
Prior art keywords
target electronic
message
electronic device
log
socket connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110447896.8A
Other languages
Chinese (zh)
Other versions
CN113141582A (en
Inventor
刘均
李森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN202110447896.8A priority Critical patent/CN113141582B/en
Publication of CN113141582A publication Critical patent/CN113141582A/en
Application granted granted Critical
Publication of CN113141582B publication Critical patent/CN113141582B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/20Selecting an access point
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application is applicable to the technical field of information, and provides a log export method, a log export device, computer equipment and a storage medium, wherein the log export method comprises the following steps: broadcasting a first message through a socket, wherein the first message carries a hot roll name, an IP address, a port number and identification information of a target electronic device of the terminal device; after the target electronic equipment corresponding to the identification information establishes the hotspot connection based on the hotspot name, if a socket connection establishment request sent by the target electronic equipment is received, establishing socket connection with the target electronic equipment, wherein the socket connection establishment request carries the IP address and the port number; and receiving the log data sent by the target electronic equipment through the socket connection. By the method, the log data of the target electronic equipment can be acquired quickly, conveniently and low in cost.

Description

Log export method and device, computer equipment and storage medium
Technical Field
The present application belongs to the field of information technology, and in particular, to a log export method and apparatus, a computer device, and a storage medium.
Background
Currently, in order to be able to provide services for systems (e.g., computer systems, satellite navigation systems) and the like on a vehicle (e.g., automobile, aviation, ship, train), it is common to install electronic equipment, such as a T-BOX, on the vehicle. The T-BOX is short for Telematics BOX, which is a compound word of Telecommunications and information science (information) for long-distance communication.
During the use of the T-BOX, the T-BOX inevitably becomes out of order due to problems such as software BUGs (BUGs), compatibility, or configuration errors. In order to quickly locate and solve the problem, the log (log) of the T-BOX needs to be checked. However, unlike a mobile phone and a Personal Computer (PC), the T-BOX has no display screen per se, no input/output device (e.g., no mouse, keyboard, etc.), and is not easily detached once it is mounted on a transportation vehicle.
The existing method for exporting the T-BOX log is to connect a Universal Serial Bus (USB) or a Universal Asynchronous Receiver/Transmitter (UART) with a computer to further export the T-BOX log. In this method, if the T-BOX is already mounted on the vehicle, the T-BOX needs to be detached. And if the shell of the T-BOX is not reserved with a USB port or a UART port, the shell of the T-BOX also needs to be disassembled, and the T-BOX is inconvenient to disassemble after being shipped and loaded, so the log exporting method is inconvenient to operate and easy to damage T-BOX equipment.
Another log exporting method is that the T-BOX device uploads the log to a server through a 4G network, and then a developer downloads the log for analysis. This scheme passes through 4G network connection server, uploads the log, can need not dismantle equipment, convenient and fast. However, this solution is costly because it requires a server to be built by itself or a third party service to be purchased. Moreover, when log is large, uploading log requires a large flow rate, which also increases cost. In addition, when the T-BOX device needs to establish a connection with a server through a 4G network, problems of poor signal, card compatibility, and the like may also occur, which may cause the T-BOX device to be unable to establish a connection with the server successfully, and further cause a developer to be unable to derive a log to analyze the problems.
Disclosure of Invention
The embodiment of the application provides a log exporting method, which can solve the problems of inconvenient operation and high cost of the existing log exporting method.
In a first aspect, an embodiment of the present application provides a log export method, which is applied to a terminal device, and includes:
broadcasting a first message through a socket, wherein the first message carries a hot roll name, an Internet Protocol (IP) address, a port number and identification information of a target electronic device of the terminal device;
after the target electronic device corresponding to the identification information establishes the hotspot connection based on the hotspot name, if a socket connection establishment request sent by the target electronic device is received, establishing socket connection with the target electronic device, wherein the socket connection establishment request carries the IP address and the port number;
and receiving the log data sent by the target electronic equipment through the socket connection.
Optionally, the broadcasting the first packet through the socket includes:
and broadcasting the first message for multiple times through a socket, wherein the time interval between two adjacent broadcasts is preset interval duration.
Optionally, after the receiving, through the socket connection, log data sent by the target electronic device, the method includes:
and verifying whether the log data is correct or not, and returning a corresponding response packet according to a verification result.
Optionally, the receiving, through the socket connection, log data sent by the target electronic device includes:
receiving an encrypted second message sent by the target electronic device through the socket connection, wherein the second message carries log data;
the verifying whether the log data is correct comprises:
and analyzing a check value from the encrypted second message, if the check value is the same as a pre-stored check value, judging that the log data is correct, and otherwise, judging that the log data is incorrect.
Optionally, the identification information is a product serial number or a designated value, and if the identification information is the product serial number, the target electronic device is an electronic device corresponding to the product serial number; and if the identification information is the designated value, the target electronic equipment is all electronic equipment in the local area network.
In a second aspect, an embodiment of the present application provides a log deriving method, which is applied to an electronic device, and includes:
receiving a first message broadcasted by a terminal device, wherein the first message carries identification information and a hot roll name, an IP address and a port number of the terminal device;
matching the identification information of the first message with pre-stored identification information;
if the matching is successful, establishing hot spot connection with the terminal equipment through the hot spot name;
sending a socket connection establishment request to the terminal device, wherein the socket connection establishment request comprises the IP address and the port number carried by the first message;
and if the socket connection is established with the terminal equipment, sending the log data through the socket connection.
Optionally, before the receiving the first packet broadcast by the terminal device, the method further includes:
and starting a promiscuous mode to monitor all network data packets.
In a third aspect, an embodiment of the present application provides a log deriving apparatus, which is applied to a terminal device, and includes:
the broadcast module is used for broadcasting a first message through a socket, wherein the first message carries a hot roll name, an IP address, a port number and identification information of a target electronic device of the terminal device;
the socket connection module is used for establishing a socket connection with the target electronic device if a socket connection establishment request sent by the target electronic device is received after the target electronic device corresponding to the identification information establishes a hot spot connection based on the hot spot name, wherein the socket connection establishment request carries the IP address and the port number;
and the data receiving module is used for receiving the log data sent by the target electronic equipment through the socket connection.
In a fourth aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method according to any one of the first aspect or the second aspect is implemented.
In a fifth aspect, the present application provides a storage medium storing a computer program, which when executed by a processor implements the method according to any one of the first or second aspects.
In a sixth aspect, embodiments of the present application provide a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of any one of the first aspect or the second aspect.
Compared with the prior art, the embodiment of the application has the advantages that:
in the embodiment of the application, because the terminal device broadcasts the first message through a socket (socket), and the first message carries the hot spot name, the IP address, the port number, and the identification information of the target electronic device of the terminal device, the electronic devices around the terminal device can receive the first message, and judge whether the electronic devices themselves are the target electronic devices that need to upload logs through the identification information of the electronic devices carried by the first message, if necessary, establish a hot spot connection with the terminal device through the hot spot name carried by the first message, establish a socket connection with the terminal device based on the established hot spot connection and the IP address and the port number carried by the first message, and finally send log data to the terminal device based on the socket connection. That is, in the embodiment of the present application, the terminal device and the target electronic device implement transmission of log data through the established hotspot connection and socket connection, and can also implement transmission of log data without an established server, and the target electronic device does not need to have a USB port and a UART port, so that the log export method of the embodiment of the present application is simple in operation and low in cost when exporting log data.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below.
FIG. 1 is a flowchart of a log export method according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a log export method according to a second embodiment of the present disclosure;
FIG. 3 is a flowchart of a log export method provided in the third embodiment of the present application;
fig. 4 is a block diagram of a log deriving apparatus applied to a terminal device according to a fourth embodiment of the present application;
fig. 5 is a block diagram illustrating a configuration of a log deriving device applied to an in-vehicle device according to a fifth embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device provided in a sixth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise.
The first embodiment is as follows:
when the log is exported by the existing method, the log does not need to be exported by connecting a USB or UART port of electronic equipment (such as T-BOX) with a computer, and the log does not need to be exported by setting up a server and exporting the log through a 4G network. That is, the existing method is inconvenient to operate and not too high in cost when the log is exported.
In order to solve the technical problem, an embodiment of the present application provides a log export method, in which an electronic device establishes a hotspot connection with a terminal device, and after the hotspot connection is established, the electronic device establishes a socket connection with the terminal device, and sends log data to the terminal device through the established socket connection.
Because the terminal device usually has the function options of the personal hotspot, the electronic device can communicate with the terminal device after accessing the hotspot of the terminal device, that is, the built server is not needed for communication, thereby saving the cost. In addition, the electronic equipment and the terminal equipment do not need to communicate by means of a USB or UART port, so that the operation is very convenient.
The following describes a log export method provided in an embodiment of the present application with reference to the drawings.
Fig. 1 shows a flowchart of a first log exporting method provided by an embodiment of the present application, where the log exporting method is applied to a terminal device, the terminal device includes a mobile phone and a PC, and details are as follows:
step S11, broadcasting a first message through the socket, wherein the first message carries the hot roll name, the IP address, the port number and the identification information of the target electronic equipment.
In this embodiment, before broadcasting the first packet, the terminal device sets a hot roll name, an IP address, and a port number, and then initializes a socket for sending the broadcast. The initialization of the socket for sending the broadcast is mainly to set parameters of the broadcast. Specifically, a log service program is installed on the terminal device, and the log service program is used for starting two threads: a broadcast thread and a socket service thread, respectively. The broadcasting thread is responsible for broadcasting the hot spot name, the IP address, the port number and the identification information of the target electronic equipment of the local machine; and the receiving thread is responsible for waiting for the connection of the target electronic equipment, and starting the receiving thread to receive and store the log file. When a user wants to acquire log data of a target electronic device, the log service program is started, then the user is prompted to set a hot spot name, an IP address, a port number and identification information of the target electronic device, and then a broadcast thread is started to broadcast a first message containing the hot spot name, the IP address, the port number and the identification information of the target electronic device. Because the user can obtain the log data of the target electronic equipment through the log service program installed on the terminal equipment, and the user usually carries the terminal equipment with him, the convenience for obtaining the log data is greatly improved.
The target electronic device is an electronic device that a user wants to acquire log data, for example, when one electronic device fails, the electronic device is an electronic device that the user wants to acquire log data; for another example, when a user needs to view log data of a certain electronic device (even if the electronic device does not have a fault), the certain electronic device is the electronic device that needs to upload the log data. In this embodiment, it is considered that a plurality of electronic devices may exist in a range covered by a hotspot of the terminal device, and some electronic devices are electronic devices for which the terminal device does not wish to acquire log data, so that the broadcasted first message carries identification information of the target electronic device, which is helpful for the electronic device to learn whether the electronic device needs to upload the log data, thereby improving accuracy of the log data acquired by the terminal device.
Step S12, after the target electronic device corresponding to the identification information establishes the hotspot connection based on the hotspot name, if a socket connection establishment request sent by the target electronic device is received, establishing a socket connection with the target electronic device, where the socket connection establishment request carries the IP address and the port number.
Specifically, after the terminal device broadcasts the first message, the terminal device serves as a socket server, binds an IP address and a port number, and invokes a listening thread (listen) to wait for a connection of a client (i.e., the vehicle-mounted device electronic device).
In this embodiment, after the terminal device establishes the hotspot connection with the target electronic device, the terminal device may subsequently receive a socket connection establishment request sent by the target electronic device. And after the target electronic equipment initiates a socket connection establishment request to the terminal equipment through the IP address and the port carried by the first message, the terminal equipment establishes socket connection with the target electronic equipment based on the socket connection establishment request. The number of the target electronic devices may be one or more.
Step S13, receiving the log data sent by the target electronic device through the socket connection.
Specifically, since the terminal device establishes a socket connection with the target electronic device, the terminal device can receive log data sent by the target electronic device.
In the embodiment of the application, because the terminal device broadcasts the first message through the socket, and the first message carries the hot-spot name, the IP address, the port number, and the identification information of the target electronic device of the terminal device, the electronic devices around the terminal device can receive the first message, and judge whether the electronic devices themselves are the target electronic devices needing to upload logs through the identification information of the electronic devices carried by the first message, if so, establish a hot-spot connection with the terminal device through the hot-spot name carried by the first message, establish a socket connection with the terminal device based on the established hot-spot connection and the IP address and the port number carried by the first message, and finally send log data to the terminal device based on the socket connection. That is, in the embodiment of the present application, the terminal device and the target electronic device implement transmission of log data through the established hotspot connection and socket connection, and can also implement transmission of log data without an established server, and the target electronic device does not need to have a USB port and a UART port, so that the log export method of the embodiment of the present application is simple in operation and low in cost when exporting log data.
In some embodiments, the first message of the embodiment of the present application further carries a password corresponding to the hot-spot name, so that, when a certain electronic device (not necessarily a target electronic device) desires to establish a hot-spot connection with a terminal device subsequently, the terminal device selects whether to establish the hot-spot connection with the electronic device by comparing whether the password carried by a hot-spot connection establishment request sent by the electronic device is the same as the password corresponding to the hot-spot name. In some embodiments, when the first message further carries a password corresponding to the hot roll name, the hot roll name and the password are encrypted and then broadcast through the first message, so that only the electronic device knowing the decryption key can obtain the hot roll name and the password through the decrypted data, and then the hot connection is established with the terminal device according to the obtained hot roll name and the password.
Because the first message also comprises the password corresponding to the hot roll call, the terminal equipment can filter the electronic equipment with incorrect password, thereby improving the accuracy of the subsequently received log data. Of course, if the first packet carries the password corresponding to the hot-spot name, the terminal device needs to set the password corresponding to the hot-spot name before broadcasting the first packet.
Example two:
fig. 2 shows a flowchart of a log deriving method provided in the second embodiment of the present application, in this embodiment, step S21 is a step for refining step S11 of the first embodiment, and step S22, step S23, and step S24 are respectively the same as step S12, step S13, and step S14, and are not repeated here:
step S21, the first message is broadcasted for many times through the socket, the time interval between two adjacent broadcasts is a preset interval duration, and the first message carries the hot roll name, the IP address, the port number and the identification information of the target electronic device.
In this embodiment, after broadcasting one first packet, after waiting for a period of time, another first packet is continuously broadcast, that is, since the first packet is not broadcast without interruption but the resource of the terminal device needs to be consumed for broadcasting the first packet, the resource of the terminal device can be effectively saved by broadcasting the first packet at intervals.
Step S22, after the target electronic device corresponding to the identification information establishes the hotspot connection based on the hotspot name, if a socket connection establishment request sent by the target electronic device is received, establishing a socket connection with the target electronic device, where the socket connection establishment request carries the IP address and the port number.
In this embodiment, after the socket connection is established between the terminal device and all the target electronic devices, the first packet is not broadcasted, so as to save resource consumption of the terminal device. In other embodiments, when the target electronic devices are all the electronic devices in the lan, that is, the terminal device itself does not know the number of the target electronic devices, the broadcasting of the first message is stopped after the preset time period.
Step S23, receiving the log data sent by the target electronic device through the socket connection.
Specifically, one socket connection is used for receiving a second message sent by one target electronic device, that is, when the terminal device needs to receive second messages sent by a plurality of target electronic devices, the terminal device receives corresponding second messages through the established plurality of socket connections. Because one socket connection only receives the second message sent by one target electronic device, the terminal device can correctly distinguish the target electronic device to which the log belongs.
In the embodiment of the application, because the first message is broadcast at intervals, not only can the target electronic device be ensured to be capable of monitoring the first message, but also the resources of the terminal device can be saved as much as possible.
In some embodiments, to improve the security of the transmitted first message, the first message broadcast in step S11 (or step S21) is an encrypted message.
In this embodiment, since the broadcasted first message is an encrypted message, even if the electronic device receives the first message, if the electronic device does not have a key (when the electronic device is not the target electronic device), the electronic device cannot decrypt the first message, that is, cannot obtain information such as a hotspot name, an IP address, and a port number carried in the first message.
In some embodiments, when the target electronic device leaves a factory, a key for decrypting the first message is preset in the target electronic device. In this embodiment, it is considered that the electronic device does not usually have a USB or UART port, and therefore, the key for decrypting the first message is set in the electronic device in advance, which can avoid the inconvenience of operation caused by setting the key to the electronic device after leaving the factory.
In some embodiments, after step S23 (or step S13), comprising:
and verifying whether the log data is correct or not, and returning a corresponding response packet according to a verification result.
In this embodiment, whether the log data is correct or not may be verified according to the length, format, and the like of the log data, if the log data is verified to be correct, a response packet that is successfully received is returned and the received log data is stored, otherwise, an error response packet (error packet) is returned and the received log data is discarded.
In some embodiments, when the data volume of the log data is large, for convenience of transmission, the target electronic device packs the log data and then sends the log data to the terminal device, and the terminal device receives a compressed packet corresponding to the log data.
In some embodiments, the electronic device generates a second message according to the compressed packet of the log data, and then sends the second message to the terminal device. In order to improve the security of the second message, the second message is an encrypted message, that is, the terminal device receives the encrypted second message, and after the step S13 (or step S23), the method includes:
and decrypting the second message to obtain a compressed packet of the log data of the target electronic equipment.
Specifically, the terminal device initializes a socket for receiving the second packet, that is, sets a parameter for receiving the second packet, so that the second packet can be successfully received in the following. The second packet includes necessary information such as a header and a trailer, in addition to the compressed packet of the log data of the target electronic device.
In this embodiment, the terminal device and the target electronic device agree in advance on a password for encrypting the second message. The password used for encrypting the second message may be stored in the target electronic device in advance, for example, the password used for encrypting the second message may be stored before the target electronic device is shipped. Therefore, the inconvenience in operation caused by setting the key to the target electronic equipment after delivery can be avoided.
In some embodiments, the step S23 (or step S13) includes:
receiving an encrypted second message sent by the target electronic device through the socket connection, wherein the second message carries log data; specifically, since the second message is transmitted in an encrypted state, it is advantageous to improve the security of the second message.
Correspondingly, the verifying whether the log data is correct includes:
and analyzing a check value from the encrypted second message, if the check value is the same as a pre-stored check value, judging that the log data is correct, and otherwise, judging that the log data is incorrect.
In this embodiment, the corresponding second message is decrypted from the encrypted second message, and then the check value carried in the second message is used to verify whether the log data (or the compressed packet of the log data) carried in the second message is correct (mainly verify whether the log data is modified), for example, after the check value is processed, it is determined whether the processed check value is the same as a pre-stored numerical value, if so, it is determined that the log data carried in the second message is correct, the terminal device returns a response packet that is successfully received and stores the received log data, otherwise, an error response packet (error packet) is returned, and the received log data is discarded. After the log data are received, the log data are verified, and only the log data which pass the verification are stored, so that the stored log data can be guaranteed to be correct log data.
In some embodiments, when the log data is transmitted in the form of compressed packets, the second message further includes a packet sequence number and a total packet number of the compressed packets of the log data, and the verification result indicates that the compressed packets are correct, and after step S23 (or step S13), the method includes: and judging whether the target electronic equipment still has an unsent compressed packet according to the packet sequence number and the total packet number of the compressed packets, if so, returning to the step of S23 (or the step S13), and if not, closing the socket connection and exiting the socket service thread. Of course, if there are still other steps (such as the step of verifying the compressed packet) after the step S23 (or the step S13), the step S23 (or the step S13) needs to be returned after the step S23 (or the step S13) is returned, and the description is omitted here.
In this embodiment, the terminal device compares whether the packet number of the compressed packet carried in the second packet is the same as the total packet number, and if the packet number of the compressed packet carried in the second packet is different from the total packet number, determines that the target electronic device still has an unsent compressed packet, and if the packet number of the compressed packet carried in the second packet is the same as the total packet number, determines that the target electronic device does not have an unsent compressed packet.
In some embodiments, the identification information is a Serial Number (SN) or a specified value, and if the identification information is the SN, the target electronic device is an electronic device corresponding to the SN; and if the identification information is the designated value, the target electronic equipment is all electronic equipment in the local area network.
Here, the specified values may be all values of 0, that is, all values set at the positions for storing the identification information of the target electronic device are 0, and of course, the specified values may also be all values of 1. It is only necessary to set a value that cannot be SN, and is not particularly limited herein.
The local area network is a local area network within a coverage range of a hotspot of the terminal equipment.
In this embodiment, because the identification information of the target electronic device is the SN or the specified value, when the identification information is the SN, the corresponding electronic device can be uniquely indicated, and when the identification information is the specified value, all the electronic devices in the local area network can be indicated, so that the terminal device can change the electronic device that needs to upload the log by changing the identification information of the target electronic device, thereby greatly improving the flexibility of change.
In some embodiments, before the terminal device establishes the hotspot connection with the target electronic device, the network speed of the WiFi local area network where the terminal device is located is fast, so that when the identification information of the target electronic device is SN, only one SN is carried by one first message (i.e., multiple SNs are not carried), and thus, after the electronic device receives the first message, the SN can be extracted fast (i.e., each SN does not need to be intercepted from multiple SNs, thereby saving the intercepting step), and further facilitating fast judgment of whether the terminal device is the target electronic device.
Example three:
fig. 3 shows a flowchart of a log export method provided in the third embodiment of the present application, where the log export method is applied to an electronic device (i.e., a target electronic device (e.g., T-BOX) communicating with the terminal devices of the first embodiment and the second embodiment), and details are as follows:
step S31, receiving a first packet broadcast by a terminal device, where the first packet carries identification information and a hot roll name, an IP address, and a port number of the terminal device.
In this embodiment, the electronic device monitors whether a network data packet exists, and if a first message broadcast by the terminal device is monitored, a hotspot name, an IP address, a port number and identification information of the target electronic device carried by the first message are analyzed from the first message.
And step S32, matching the identification information of the first message with pre-stored identification information.
Specifically, the electronic device compares the analyzed identification information of the target electronic device with the pre-stored identification information of the electronic device, if the analyzed identification information is the same as the pre-stored identification information of the electronic device, the electronic device is judged to be the electronic device which needs to upload the log data, namely the target electronic device, and otherwise, the electronic device is judged not to be the target electronic device.
And step S33, if the matching is successful, establishing hot spot connection with the terminal equipment through the hot spot name.
Step S34, sending a socket connection establishment request to the terminal device, where the socket connection establishment request includes the IP address and the port number carried in the first packet.
In this embodiment, the electronic device initializes a socket for sending the log, and sends a socket connection establishment request to the terminal device based on the IP address and the port number analyzed from the first packet.
Step S35, if a socket connection is established with the terminal device, sending log data through the socket connection.
In the embodiment of the application, the electronic device does not need to be provided with a USB or UART port, and can realize the transmission of the log data without a built server, so that the log export method is simple in operation and low in cost when exporting the log data.
In some embodiments, the log export method further comprises:
and starting a promiscuous mode to monitor all network data packets.
Specifically, before monitoring the first packet broadcast by the terminal device, the monitoring mode needs to be started to monitor the network packet, and a socket for receiving the broadcast data is initialized. In this embodiment, considering that the promiscuous mode can monitor all network packets, that is, the network packets are not filtered, so that any network packet is not missed, and the first packet broadcast by the terminal device can be monitored in time, so that the started monitoring mode is the promiscuous mode.
In some embodiments, if the first message further carries a password corresponding to the hotspot name, the step S33 specifically includes: and establishing hotspot connection with the terminal equipment through the hotspot names and the passwords corresponding to the hotspot names.
In some embodiments, the first message is an encrypted message, and the electronic device performs a decryption operation according to a key for decrypting the first message, and then parses the identification information carried in the obtained first message and the hot roll name, the IP address, and the port number of the terminal device. The key for decrypting the first message may be set in the electronic device when the electronic device leaves a factory.
In some embodiments, in order to facilitate transmission, log data to be uploaded is compressed to obtain a corresponding compressed packet, a second message is generated according to the compressed packet, and the generated second message is sent to the terminal device through the established socket connection.
In some embodiments, the identification information of the target electronic device is an SN or a specified value, and if the identification information of the target electronic device is an SN, the target electronic device is an electronic device corresponding to the SN. And if the identification information of the target electronic equipment is the designated value, the target electronic equipment is all the electronic equipment in the local area network.
Here, the designated values may be all 0 values, that is, all 0 values set at the positions for storing the identification information of the target electronic device, and of course, the designated values may also be all 1 values. It is only necessary to set a value that cannot be SN, and is not particularly limited herein.
The local area network is a local area network within a coverage range of a hotspot of the terminal equipment.
In some embodiments, if the first message is an encrypted message, after monitoring the first message, the electronic device decrypts the first message according to a key for decrypting the first message, and then selects whether to send a hotspot connection establishment request to the terminal device according to a decryption result. For example, if the identification information of the target electronic device in the decryption result is an SN, the electronic device compares the SN with its own SN (i.e., identification information), and if the SN and the SN are the same, sends a hotspot connection establishment request to the terminal device; and if the identification information of the target electronic equipment in the decryption result is the designated value, the electronic equipment sends a hotspot connection establishment request to the terminal equipment.
In some embodiments, the key agreed between the electronic device and the terminal device may be set when the electronic device leaves a factory, so as to avoid operation inconvenience caused by setting the key to the electronic device after leaving the factory.
In some embodiments, after monitoring a first message broadcast by a terminal device and determining that identification information of a target electronic device carried in the first message matches with pre-stored identification information, the electronic device turns off a promiscuous mode and turns off a socket for receiving broadcast data.
In this embodiment, since it is necessary to initialize a socket for sending a log subsequently, and an initialized parameter corresponding to the socket for receiving broadcast data is different from an initialized parameter corresponding to the socket for sending the log, the socket for receiving broadcast data needs to be closed here. In addition, since the promiscuous mode can listen to all network packets, and the electronic device has received the message that the electronic device wishes to receive, the promiscuous mode is turned off to avoid interference of other messages to the electronic device.
In some embodiments, when the data volume of the log data to be transmitted is large, the electronic device packages the log data and then sends the log data to the terminal device for transmission.
In some embodiments, the electronic device generates a second message according to the compressed packet of the log data, and then sends the second message to the terminal device. At this time, step S35 includes: and if the socket connection is established with the terminal equipment, sending a second message through the socket connection, wherein the second message carries a compressed packet corresponding to the log data. Specifically, after compressing and packaging the log data to be uploaded, the electronic device obtains a corresponding compressed file. It should be noted that, in the process of performing compression and packing, the total number of packets is calculated according to the preset packet length. When the log data needs to be sent, reading the data of the compressed file (only reading the data of one preset packet length at a time) and the total packet number according to the preset packet length, forming a second message according to the current packet sequence number, the read data of the compressed file and the total packet number, and sending the second message to the terminal equipment.
In this embodiment, in order to avoid that the compressed packet transmitted at one time is too large, the size of each compressed packet needs to be limited, and in this embodiment, the preset packet length is in the order of "K", for example, 64K bits (bit) in size.
In some embodiments, in order to improve the security of the second message, the electronic device encrypts the second message and then sends the second message to the terminal device.
In some embodiments, the electronic device determines the log that needs to be uploaded according to the following: 1) determining according to a time point of establishing a hotspot connection with the terminal device, for example, taking all logs within a first preset time (e.g., 1 hour) before the time point of establishing the hotspot connection as logs to be uploaded; 2) if the electronic equipment does not have a fault, the electronic equipment takes all logs in a second preset time length (the second preset time length is greater than the first preset time length) before the time point of establishing the hotspot connection as logs needing to be uploaded; 3) the electronic device reports the log of the corresponding type according to the requirement of the terminal device (at this time, the first message also carries the type information of the log to be reported), for example, if the type information of the log carried by the first message is network type information, the electronic device only takes the log of the network type information as the log to be reported.
In this embodiment, because the corresponding logs are transmitted according to different scenes, the accuracy of the transmitted logs can be improved.
In some embodiments, after step S35, comprising:
and waiting for the response packet, and if the waiting time is longer than a preset time threshold value or an error packet sent by the terminal equipment is received, sending the previous second message to the terminal equipment again. And if a response packet which indicates successful reception and is sent by the terminal equipment is received, reading data corresponding to the packet sequence number after 1 increment in the compressed file, forming a new second message according to the packet sequence number after 1 increment, the newly read data and the total packet number, and sending the new second message to the terminal equipment. Of course, if the data read last time is the file tail of the compressed file, the compressed file is closed, the compressed packet corresponding to the compressed file is deleted, the socket connection is disconnected, and the socket is closed.
In some embodiments, in order to improve the security of the second message, the electronic device encrypts the second message and then sends the encrypted second message to the terminal device.
In this embodiment, the password for encrypting the second message may be set when the electronic device leaves a factory, so as to avoid operation inconvenience caused by setting a key to the electronic device after leaving the factory.
In some embodiments, the second message carries a check value, so that the terminal device verifies whether the log data (or the compressed packet of the log data) is modified according to the check value.
In some embodiments, when the log data is transmitted in the form of compressed packets, the second packet further includes a packet sequence number of the compressed packets of the log data and a total packet number.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example four:
fig. 4 shows a block diagram of a log deriving device provided in the embodiment of the present application, which corresponds to the log deriving methods of the first embodiment and the second embodiment, and the log deriving device is applied to a terminal device.
Referring to fig. 4, the log deriving device 4 includes: a broadcast module 41, a socket connection module 42, and a data receiving module 43. Wherein:
the broadcasting module 41 is configured to broadcast a first message through a socket, where the first message carries a hot roll name, an IP address, a port number, and identification information of a target electronic device of the terminal device.
The socket connection module 42 is configured to, after establishing a hotspot connection based on the hotspot name, establish a socket connection with the target electronic device if a socket connection establishment request sent by the target electronic device is received, where the socket connection establishment request carries the IP address and the port number.
A data receiving module 43, configured to receive, through the socket connection, log data sent by the target electronic device.
In the embodiment of the application, the terminal device and the target electronic device realize the transmission of log data through the established hot spot connection and socket connection, the transmission of the log data can be realized without an established server, and the target electronic device does not need to be provided with a USB (universal serial bus) port and a UART (universal asynchronous receiver/transmitter) port, so that the log export method is simple in operation and low in cost when the log data is exported.
In some embodiments, the first message in the embodiments of the present application further carries a password corresponding to the hot roll call. Further, when the first message also carries the password corresponding to the hot roll name, the hot roll name and the password are both encrypted and then broadcast through the first message.
In some embodiments, the first packet broadcasting unit 41 is specifically configured to: the first message is broadcasted for multiple times through the socket, the time interval between two adjacent broadcasts is the duration of a preset interval, and the first message carries the hot roll name, the IP address, the port number and the identification information of the target electronic equipment.
In some embodiments, in order to improve the security of the transmitted first message, the broadcasted first message is set to be an encrypted message.
In some embodiments, the log exporting apparatus 4 includes:
and the log data verification module is used for verifying whether the log data is correct or not and returning a corresponding response packet according to a verification result.
In some embodiments, the data receiving module 43 is specifically configured to receive, through the socket connection, a compressed packet of log data sent by the target electronic device.
In some embodiments, the data receiving module 43 is specifically configured to receive, through the socket connection, a second message sent by the target electronic device, where the second message includes a compressed packet of log data.
In some embodiments, to improve the security of the second message, the second message is an encrypted message. Correspondingly, the log deriving device 4 further includes:
and the second message decryption module is used for decrypting the second message to obtain a compressed packet of the log data of the target electronic equipment.
In some embodiments, the data receiving module 43 is specifically configured to:
and receiving an encrypted second message sent by the target electronic equipment through the socket connection, wherein the second message carries log data.
Correspondingly, the log data verification module is specifically configured to:
and analyzing a check value from the encrypted second message, if the check value is the same as a pre-stored check value, judging that the log data is correct, and otherwise, judging that the log data is incorrect.
In some embodiments, when the log data is transmitted in the form of compressed packets, the second packet further includes a packet sequence number of the compressed packets of the log data and a total packet number, and the verification result indicates that the compressed packets are correct, then the log deriving device 4 further includes:
and a compressed packet number judging module, configured to judge whether there is a compressed packet that has not been sent by the target electronic device according to the packet sequence number of the compressed packet and the total packet number, and if there is a compressed packet that has not been sent by the target electronic device, return to the execution data receiving module 43 and the subsequent modules.
In some embodiments, the identification information of the target electronic device is SN or a specified value, and if the identification information is the product serial number, the target electronic device is an electronic device corresponding to the product serial number; and if the identification information is the designated value, the target electronic equipment is all electronic equipment in the local area network.
Here, the designated values may be all 0 values, that is, all 0 values set at the positions for storing the identification information of the target electronic device, and of course, the designated values may also be all 1 values. It is only necessary to set a value that cannot be SN, and is not particularly limited herein.
The local area network is a local area network within a coverage range of a hotspot of the terminal equipment.
In some embodiments, before the terminal device establishes the hotspot connection with the target electronic device, the network speed of the WiFi local area network where the terminal device is located is fast, so that when the identification information of the target electronic device is SN, only one SN is carried by one first message (i.e., multiple SNs are not carried), and thus, after the electronic device receives the first message, the SN can be extracted fast (i.e., each SN does not need to be intercepted from multiple SNs, thereby saving the intercepting step), and further facilitating fast judgment of whether the terminal device is the target electronic device.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Example five:
corresponding to the log deriving method of the fourth embodiment, fig. 5 shows a structural block diagram of a log deriving device provided in the embodiment of the present application, which is applied to an electronic device, and for convenience of explanation, only the parts related to the embodiment of the present application are shown.
The log deriving device 5 includes: the system comprises a first message receiving module 51, an identification information matching module 52, a hot spot connection establishing module 53, a socket connection establishing request sending module 54 and a log data sending module 55. Wherein:
a first message receiving module 51, configured to receive a first message broadcasted by a terminal device, where the first message carries identification information and a hot roll name, an IP address, and a port number of the terminal device;
an identification information matching module 52, configured to match the identification information of the first packet with pre-stored identification information;
the hot spot connection establishing module 53 is configured to establish a hot spot connection with the terminal device through the hot spot name if the matching is successful;
a socket connection establishment request sending module 54, configured to send a socket connection establishment request to the terminal device, where the socket connection establishment request includes the IP address and the port number carried in the first packet;
and a log data sending module 55, configured to send log data through a socket connection if the socket connection is established with the terminal device.
In the embodiment of the application, the electronic device does not need to be provided with a USB or UART port, and can transmit the log without a built server, so that the log exporting method is simple in operation and low in cost when the log is exported.
In some embodiments, the log exporting apparatus 5 further comprises:
and the promiscuous mode starting module is used for starting the promiscuous mode to monitor all network data packets.
In some embodiments, the identification information of the target electronic device is an SN or a specified value, and if the identification information of the target electronic device is an SN, the target electronic device is an electronic device corresponding to the SN. And if the identification information of the target electronic equipment is the designated value, the target electronic equipment is all the electronic equipment in the local area network.
In some embodiments, if the first message is an encrypted message, the log deriving device 5 further includes:
and the first message decryption module is used for executing decryption operation according to the key for decrypting the first message.
In some embodiments, the key for decrypting the first message may be set in the electronic device at the time of factory shipment of the electronic device.
In some embodiments, the log exporting apparatus 5 further comprises:
and the promiscuous mode closing module is used for closing the promiscuous mode and closing the socket for receiving the broadcast data after monitoring the first message broadcasted by the terminal equipment and judging that the identification information of the target electronic equipment carried by the first message is matched with the prestored identification information.
In some embodiments, when the data volume of the log data to be transmitted is large, the electronic device packages the log data and then sends the log data to the terminal device for transmission. At this time, the log data sending module 55 is specifically configured to send the compressed packet of the log data through the socket connection if the socket connection is established with the terminal device.
In some embodiments, the electronic device generates a second message according to the compressed packet of the log data, and then sends the second message to the terminal device. At this time, the log data sending module 55 is specifically configured to, if a socket connection is established with the terminal device, send a second message through the socket connection, where the second message carries a compressed packet corresponding to the log data.
In some embodiments, if the data volume of the log data is large, the compressed log data needs to be sent in batches through a plurality of second messages, in this case, the log deriving device 5 further includes:
and the second message generation module is used for reading data of a compressed file according to a preset packet length (only reading data of one preset packet length at a time), and forming a second message according to the read data, the total packet number and the current packet sequence number, wherein the compressed file is obtained by compressing and packaging log data to be uploaded.
In some embodiments, if the total number of packets is greater than or equal to 2, the log data sending module 55 is specifically configured to:
if the socket connection is established with the terminal equipment, a second message is sent through the socket connection, and the second message comprises a compressed packet of log data of the electronic equipment; and waiting for the response packet, and if the waiting time is longer than a preset time threshold or an error packet sent by the terminal equipment is received, sending the previous second message to the terminal equipment again. And if a response packet which indicates successful reception and is sent by the terminal equipment is received, reading data corresponding to the packet sequence number after 1 increment in the compressed file, forming a new second message according to the packet sequence number after 1 increment, the newly read data and the total packet number, and sending the new second message to the terminal equipment. Of course, if the data read last time is the file tail of the compressed file, the compressed file is closed, the compressed packet corresponding to the compressed file is deleted, the socket connection is disconnected, and the socket is closed.
In some embodiments, in order to improve the security of the second packet, the log deriving device 5 further includes:
and the second message encryption unit is used for encrypting the second message and then sending the second message to the terminal equipment.
Example six:
fig. 6 is a schematic structural diagram of a computer device according to a sixth embodiment of the present application. The computer device includes a terminal device and an electronic device, and as shown in fig. 6, the computer device 6 of this embodiment includes: at least one processor 60 (only one processor is shown in fig. 6), a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, wherein the processor 60 executes the computer program 62 to implement the steps of any of the first, second, and third embodiments.
The computer device 6 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The computer device may include, but is not limited to, a processor 60, a memory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of the computer device 6 and does not constitute a limitation of the computer device 6, and may include more or less components than those shown, or combine certain components, or different components, such as input output devices, network access devices, etc.
The Processor 60 may be a Central Processing Unit (CPU), and the Processor 60 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may in some embodiments be an internal storage unit of the computer device 6, such as a hard disk or a memory of the computer device 6. The memory 61 may also be an external storage device of the computer device 6 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the computer device 6. The memory 61 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 61 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
An embodiment of the present application further provides a network device, where the network device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, the processor implementing the steps of any of the various method embodiments described above when executing the computer program.
The present application further provides a storage medium (e.g., a computer-readable storage medium) storing a computer program, where the computer program is executed by a processor to implement the steps in the method embodiments of the first and second embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, all or part of the flow of the method of the embodiments described above can be implemented by a computer program, which can be stored in a storage medium and can implement the steps of the method embodiments described above when being executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal device, recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunication signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A log export method is applied to a terminal device and comprises the following steps:
broadcasting a first message through a socket, wherein the first message carries a hot roll name, an IP address, a port number and identification information of target electronic equipment of the terminal equipment, and the number of the target electronic equipment is more than or equal to 1;
after the target electronic device corresponding to the identification information establishes the hotspot connection based on the hotspot name, if a socket connection establishment request sent by the target electronic device is received, establishing socket connection with the target electronic device, wherein the socket connection establishment request carries the IP address and the port number;
and receiving the log data sent by the target electronic equipment through the socket connection.
2. The log export method of claim 1, wherein said broadcasting a first message over a socket comprises:
and broadcasting the first message for multiple times through a socket, wherein the time interval between two adjacent broadcasts is preset interval duration.
3. The log derivation method as claimed in claim 1, wherein after said receiving log data sent by the target electronic device over the socket connection, comprising:
and verifying whether the log data is correct or not, and returning a corresponding response packet according to a verification result.
4. The log exporting method according to claim 3, wherein said receiving log data sent by said target electronic device through said socket connection comprises:
receiving an encrypted second message sent by the target electronic equipment through the socket connection, wherein the second message carries log data;
the verifying whether the log data is correct comprises:
and analyzing a check value from the encrypted second message, if the check value is the same as a pre-stored check value, judging that the log data is correct, and otherwise, judging that the log data is incorrect.
5. The log exporting method according to any one of claims 1 to 4, wherein the identification information is a product serial number or a designated value, and if the identification information is the product serial number, the target electronic device is an electronic device corresponding to the product serial number; and if the identification information is the designated value, the target electronic equipment is all electronic equipment in the local area network.
6. A log exporting method applied to an electronic device comprises the following steps:
receiving a first message broadcasted by a terminal device, wherein the first message carries identification information of target electronic devices and hot roll names, IP addresses and port numbers of the terminal device, and the number of the target electronic devices is greater than or equal to 1;
matching the identification information of the target electronic equipment with prestored identification information;
if the matching is successful, establishing hot spot connection with the terminal equipment through the hot spot name;
sending a socket connection establishment request to the terminal device, wherein the socket connection establishment request comprises the IP address and the port number carried by the first message;
and if the socket connection is established with the terminal equipment, sending the log data through the socket connection.
7. The log export method of claim 6, wherein prior to receiving the first message broadcast by the terminal device, further comprising:
and starting a promiscuous mode to monitor all network data packets.
8. A log exporting apparatus applied to a terminal device includes:
the broadcast module is used for broadcasting a first message through a socket, the first message carries a hot roll name, an IP address, a port number and identification information of target electronic equipment of the terminal equipment, and the number of the target electronic equipment is greater than or equal to 1;
the socket connection module is used for establishing a socket connection with the target electronic device if a socket connection establishment request sent by the target electronic device is received after the target electronic device corresponding to the identification information establishes a hot spot connection based on the hot spot name, wherein the socket connection establishment request carries the IP address and the port number;
and the data receiving module is used for receiving the log data sent by the target electronic equipment through the socket connection.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.
10. A storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the method according to any one of claims 1 to 7.
CN202110447896.8A 2021-04-25 2021-04-25 Log export method and device, computer equipment and storage medium Active CN113141582B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110447896.8A CN113141582B (en) 2021-04-25 2021-04-25 Log export method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110447896.8A CN113141582B (en) 2021-04-25 2021-04-25 Log export method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113141582A CN113141582A (en) 2021-07-20
CN113141582B true CN113141582B (en) 2022-09-20

Family

ID=76811913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110447896.8A Active CN113141582B (en) 2021-04-25 2021-04-25 Log export method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113141582B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113805918A (en) * 2021-09-01 2021-12-17 浙江吉利控股集团有限公司 Data interaction system and method for upgrading TBOX and obtaining TBOX logs
CN114793354B (en) * 2022-04-13 2024-02-23 展讯通信(深圳)有限公司 Information transmission method, communication device, chip and module equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108153653A (en) * 2018-01-23 2018-06-12 郑州云海信息技术有限公司 A kind of BMC blog management methods, system, device and computer storage media
CN112350850A (en) * 2020-09-29 2021-02-09 宇龙计算机通信科技(深圳)有限公司 Log file reporting method and device, storage medium and electronic equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532943A (en) * 2013-10-08 2014-01-22 北京神州绿盟信息安全科技股份有限公司 Web application firewall device and asynchronous security protection log processing method
CN104780580B (en) * 2015-03-19 2018-06-12 江苏晓山信息产业股份有限公司 A kind of Wi-Fi mobile networking methods of energy consumption balance
CN107347062A (en) * 2017-06-19 2017-11-14 北京开数科技有限公司 A kind of method, electronic equipment and the readable storage medium storing program for executing of daily record data processing
CN110650218B (en) * 2018-06-27 2022-12-02 中兴通讯股份有限公司 TBox control method and device and computer readable storage medium
CN109962978A (en) * 2019-02-28 2019-07-02 深圳市盛弘电气股份有限公司 Charging pile log deriving method, charging pile and control equipment
CN110011970A (en) * 2019-02-28 2019-07-12 努比亚技术有限公司 A kind of journal obtaining method, terminal and computer readable storage medium
CN111177699B (en) * 2019-12-23 2022-07-08 恒大恒驰新能源汽车科技(广东)有限公司 Data extraction method, secret key generation method, unlocking method and device
US10771243B1 (en) * 2020-04-29 2020-09-08 Ecosteer Srl Multicast encryption scheme for data-ownership platform
CN112653740A (en) * 2020-12-11 2021-04-13 北京金山云网络技术有限公司 Load balancing method and device supporting QUIC connection migration and computer product

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108153653A (en) * 2018-01-23 2018-06-12 郑州云海信息技术有限公司 A kind of BMC blog management methods, system, device and computer storage media
CN112350850A (en) * 2020-09-29 2021-02-09 宇龙计算机通信科技(深圳)有限公司 Log file reporting method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN113141582A (en) 2021-07-20

Similar Documents

Publication Publication Date Title
CN106708489B (en) Debugging method and system of equipment
CN113141582B (en) Log export method and device, computer equipment and storage medium
CN109451487B (en) Virtual card downloading method, terminal and intermediate device
EP2437461A1 (en) Key derivation for secure communications
CN109729535B (en) Base station opening method and device, computer storage medium and equipment
CN112217795B (en) Method and device for managing communication security of intelligent electric meter
CN108664395A (en) Applied program testing method, device, equipment and storage medium
CN104619040A (en) Method and system for quickly connecting WIFI equipment
US20070274274A1 (en) Open wireless access point detection and identification
CN110716831A (en) Terminal, debugging system of USB (universal serial bus) equipment and debugging method of USB equipment
CN113423105A (en) Network connection method and device
CN113141593B (en) Detection method and detection system for vehicle virtual key and upper computer
CN113359674A (en) Vehicle diagnostic system, method, electronic device, and storage medium
US20200288331A1 (en) Method and apparatus for connecting to access point in wlan network
CN114095277A (en) Power distribution network secure communication method, secure access device and readable storage medium
CN110602693B (en) Networking method and equipment of wireless network
CN112714009A (en) Network distribution method, network equipment to be distributed and network equipment
CN113709849A (en) Network access method and device of equipment to be accessed to network, storage medium and electronic device
CN114205378A (en) Network distribution method and device of Internet of things equipment, storage medium and electronic device
CN108769989B (en) Wireless network connection method, wireless access device and equipment
CN113242060B (en) Network access method and device, storage medium and electronic device
CN107948243B (en) Internet of things communication method, terminal and system
CN111770099B (en) Data transmission method and device, electronic equipment and computer readable medium
CN116761167B (en) Data encryption transmission method, system, electronic equipment and storage medium
CN111147476B (en) Data analysis method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant