WO2018113114A1 - 双系统定向连接的方法和装置 - Google Patents

双系统定向连接的方法和装置 Download PDF

Info

Publication number
WO2018113114A1
WO2018113114A1 PCT/CN2017/077309 CN2017077309W WO2018113114A1 WO 2018113114 A1 WO2018113114 A1 WO 2018113114A1 CN 2017077309 W CN2017077309 W CN 2017077309W WO 2018113114 A1 WO2018113114 A1 WO 2018113114A1
Authority
WO
WIPO (PCT)
Prior art keywords
system device
daemon
socket connection
connection
socket
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.)
Ceased
Application number
PCT/CN2017/077309
Other languages
English (en)
French (fr)
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.)
Guangzhou Shizhen Electronics Co Ltd
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shizhen Electronics Co Ltd
Guangzhou Shiyuan Electronics Thecnology 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 Guangzhou Shizhen Electronics Co Ltd, Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shizhen Electronics Co Ltd
Publication of WO2018113114A1 publication Critical patent/WO2018113114A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Definitions

  • the present invention relates to the field of intelligent terminals, and in particular, to a method and apparatus for dual system directional connection.
  • Two Android system devices are often used, one of which is used to implement basic requirements such as display of interactive devices; another Android The system device is used to implement interaction between the interaction device and the user.
  • Android-A In the Android dual system solution, in order to communicate between the two systems, Android-A is used as the host, Android-B is used as the client, and on the Android-A, the ADB (Android Debug Bridge, Android debugging bridge) is connected to B and Send an instruction.
  • B When B needs to send a message to A, it outputs it as a log file, and A obtains the B message by parsing the log file.
  • the invention provides a dual system directional connection method and device, which can eliminate the security risks of the dual system data transmission in the prior art and improve the efficiency of data processing.
  • the first aspect employs a dual system directional connection method, including:
  • the establishing a socket connection between the first daemon of the first system device and the second daemon of the second system device includes:
  • the first daemon process of the first system device is started, and the first daemon starts the second daemon process of the second system device by using the physical address of the first system device as the startup parameter by the ADB;
  • the first daemon generates a listening socket for the socket connection, binding the socket connection to an IPv6 address of the first system device, and a physical entity directly connected to the first system device and the second system device Network card
  • the data is sent to another system device through the corresponding socket connection through the daemon of the system device and the daemon of another system device.
  • System service When the system service of the first system device or the second system device needs to communicate, the data is sent to another system device through the corresponding socket connection through the daemon of the system device and the daemon of another system device.
  • the data is sent to the daemon process of the system device and the daemon process of another system device through the corresponding socket connection.
  • the system service of another system device it also includes:
  • a file descriptor of a socket connection between the first system device and the second system device is set.
  • the data transmission between the daemon process of the first system device and the daemon process of the second system device is blind forwarding.
  • the second aspect employs a dual system directional connection device comprising:
  • a first establishing unit configured to establish a socket connection between the first daemon of the first system device and the second daemon of the second system device;
  • a second establishing unit configured to establish a socket connection between the system service of the first system device and the first daemon, and a system service of the second system device and the second daemon Socket connection between.
  • the first establishing unit includes:
  • a daemon process startup module configured to start a first daemon process of the first system device, where the first daemon process starts a second daemon process of the second system device by using an ADB with the physical address of the first system device as a startup parameter;
  • a network card connection module configured to generate a socket connection listening socket by using a first daemon, binding the socket connection to an IPv6 address of the first system device, and the first system device and a a physical network card to which the second system device is directly connected;
  • a socket connection module configured to, by the second daemon, confirm an IPv6 address of the first system device according to the startup parameter, and initiate an active socket connection to the IPv6 address by using the connected network card, to The listening socket confirms the establishment of a socket connection.
  • the device further includes:
  • a data transmission unit configured to: when the system service of the first system device or the second system device needs to communicate, connect the data through the corresponding socket connection sequentially through the daemon of the system device, and A system device daemon sends system services to another system device.
  • the device further includes:
  • a file descriptor setting unit that sets a file descriptor of a socket connection between the first system device and the second system device before data transmission.
  • the data transmission between the daemon process of the first system device and the daemon process of the second system device is blind forwarding.
  • the invention establishes a socket connection between a first daemon of the first system device and a second daemon of the second system device; establishing a system service between the first system device and the first daemon a socket connection, and a socket connection between the system service of the second system device and the second daemon, and finally establishing a data connection based on the socket connection between the dual systems, based on the socket
  • the data channel of the connected data channel has good confidentiality, improves the safety factor, and improves the data transmission efficiency.
  • Embodiment 1 is a flow chart of a method for dual system directional connection in Embodiment 1 of the present invention
  • FIG. 2A is a flowchart of a method for dual system directional connection in Embodiment 2 of the present invention
  • FIG. 2B is a schematic diagram of a data channel of a dual system directional connection in Embodiment 2 of the present invention.
  • FIG. 3 is a schematic structural diagram of an apparatus for directional connection of a dual system according to Embodiment 3 of the present invention.
  • FIG. 4 is a schematic structural view of an apparatus for directional connection of a dual system according to Embodiment 4 of the present invention.
  • FIG. 1 is a flowchart of a method for directional connection of dual systems according to Embodiment 1 of the present invention.
  • the method of this embodiment may be implemented by using hardware and/or software, and the method of the embodiment may be implemented in an application end of the terminal device.
  • the application end may be a plug-in of a certain client embedded in the user terminal, or a plug-in of an operating system of the user terminal, and a text editing client embedded in the user terminal (for example, a notepad or The editor can be used together; the application can also be a client that can provide a text editing service in the user terminal, which is not limited in this embodiment.
  • data transmission between the first system device and the second system device is mainly one-way transmission. If two-way data transmission is to be implemented, the process is relatively complicated, and the data transmission speed is relatively slow.
  • the first daemon of the first system device may start the second daemon of the second system device according to the set parameter, and establish a first according to the set parameter and the request and return between the first daemon and the second daemon.
  • the system service is the node between the outer layer interaction and the inner layer data processing.
  • the two system devices establish a socket connection between the system service and the respective daemon process respectively, in the user interaction.
  • the data in the process is transmitted between the system service and the daemon through the socket connection.
  • the socket between the system service and the daemon is in turn.
  • the technical solution of the embodiment is to establish a socket connection between the first daemon of the first system device and the second daemon of the second system device; and establish a system of the first system device. a socket connection between the service and the first daemon, and a socket connection between the system service of the second system device and the second daemon, and finally establishing a socket-based connection between the two systems
  • the data channel of the word connection, the data transmission based on the socket connection data channel has good confidentiality, improves the safety factor, and improves the data transmission efficiency.
  • FIG. 2A is a flowchart of a method for dual system directional connection according to Embodiment 2 of the present invention. As shown in the figure, the method includes:
  • Step S21 Start a first daemon of the first system device, and the first daemon starts the second daemon of the second system device by using the physical address of the first system device as the startup parameter by the ADB.
  • the initial connection mode of the first system device and the second system device in the interaction device is ADB, and the ADB is mainly used for one-way transmission.
  • the originating end of the data is defined as the first system device
  • the receiving end of the data is defined as Second system device.
  • the first daemon is started first, and the daemon can be defined by the user to perform the predetermined function.
  • the first daemon and the second daemon in the solution are used to establish the first system device and the first Directional connection of two system devices.
  • Step S22 The first daemon process generates a socket connection, and binds the socket connection to the IPv6 address of the first system device and the physical network card directly connected by the first system device and the second system device.
  • the physical connection of the socket connection is implemented by the network card.
  • the basic parameter of the connection is the IPv6 address of the first system device.
  • the first daemon binds the socket connection to the IPv6 address of the first system and connects to the same.
  • the network card of the first system device and the second system device establishes an initial connection between the first daemon and the second daemon.
  • Step S23 The second daemon process confirms the IPv6 address of the first system device according to the startup parameter, and initiates an active socket connection to the IPv6 address through the connected network card, to confirm the establishment of the socket to the listening socket. connection.
  • the first system device completes the initial setting of the socket connection establishment, and sends the physical address of the first system device and the second system device to the second system device through the ADB.
  • the second daemon confirms an IPv6 address of the first system device according to the relevant parameter, and initiates an active socket connection request by using the connected network card,
  • the first system device establishes a socket connection according to the listening result of the socket connection request initiated by the second daemon by the listening socket.
  • Step S24 Establish a socket connection between the system service of the first system device and the first daemon, and a socket connection between the system service of the second system device and the second daemon.
  • the resulting data channel is as shown in FIG. 2B.
  • the socket connection between the system service 51 of the first system device 50 and the first daemon 52 is directly established according to the reserved communication port, and the second system device 60 is The establishment process of the socket connection between the system service 61 and the second daemon 62 is similar, and the socket connection between the established first daemon 52 and the second daemon 62 is formed to form a socket-based connection.
  • Step S25 setting a file descriptor of a socket connection between the first system device and the second system device.
  • the data channel I/O is multiplexed.
  • the file descriptor of the data channel can be listened to by the poll function, and the file description can be performed. Set to.
  • the command is sent to another system device to maintain the connection; if the file is described as being "read”, the received data is read through the socket connection. And set the poll parameter, indicating that "write” is interested; if the file is described as "writeable”, the data is written and transmitted through the socket connection. If the buffer for saving the data to be written is cleared, the setting is set. The poll parameter indicates that it is not interested in "write”. If the buffer to save the data to be written is not sent once, it continues to listen to the file descriptor until the data transfer is completed.
  • Step S26 When the system service of the first system device or the second system device needs to communicate, the data is sequentially connected through the corresponding socket through the daemon of the system device, and the system device of the other device.
  • the daemon sends system services to another system device.
  • data between the daemon process of the first system device and the daemon process of the second system device is sequentially transmitted through a socket connection in a blind forwarding manner.
  • the system device sends the data corresponding to the data transmission task established by itself first, and the number of data blocks sent is equal to the number of data blocks when the data transmission task is established.
  • the technical solution of the embodiment is to establish a socket connection between the first daemon of the first system device and the second daemon of the second system device; and establish a system of the first system device. a socket connection between the service and the first daemon, and a socket connection between the system service of the second system device and the second daemon, and finally establishing a socket-based connection between the two systems
  • the data channel of the word connection, the data transmission based on the socket connection data channel has good confidentiality, improves the safety factor, and improves the data transmission efficiency.
  • data transmission based on socket connection and file descriptor-based scheduling during data transmission improve data transmission efficiency and data channel utilization.
  • FIG. 3 is a schematic structural diagram of a device for directional connection of a dual system according to Embodiment 3 of the present invention.
  • the device may be implemented by hardware and/or software, and may be independently configured in the terminal device to implement the embodiment.
  • the apparatus for directional connection of the dual system specifically includes: a first establishing unit and a second establishing unit 12;
  • a first establishing unit 10 configured to establish a socket connection between the first daemon of the first system device and the second daemon of the second system device;
  • a second establishing unit 20 configured to establish a socket connection between the system service of the first system device and the first daemon, and a system service of the second system device and the second daemon Between the socket connections.
  • each unit is performed by establishing a socket connection between the first daemon of the first system device and the second daemon of the second system device; establishing the system of the first system device a socket connection between the service and the first daemon, and a socket connection between the system service of the second system device and the second daemon, and finally establishing a socket-based connection between the two systems
  • the data channel of the word connection, the data transmission based on the socket connection data channel has good confidentiality, improves the safety factor, and improves the data transmission efficiency.
  • FIG. 4 is a schematic structural diagram of a device for directional connection of a dual system according to Embodiment 4 of the present invention.
  • the device may be implemented by hardware and/or software, and may be independently configured in the terminal device to implement the embodiment.
  • the apparatus for directional connection of the dual system specifically includes: a first establishing unit 10 and a second establishing unit 20;
  • a first establishing unit 10 configured to establish a socket connection between the first daemon of the first system device and the second daemon of the second system device;
  • a second establishing unit 20 configured to establish a socket connection between the system service of the first system device and the first daemon, and a system service of the second system device and the second daemon Between the socket connections.
  • the first establishing unit 10 includes:
  • the daemon startup module 11 is configured to start the first daemon of the first system device, first The daemon starts the second daemon of the second system device by using the physical address of the first system device as the startup parameter by the ADB;
  • the NIC connection module 12 is configured to generate a socket connection by using a first daemon, and bind the socket connection to an IPv6 address of the first system device and directly to the first system device and the second system device Connected physical network card;
  • the socket connection module 13 is configured to confirm, by the second daemon process, an IPv6 address of the first system device according to the startup parameter, and initiate an active socket connection to the IPv6 address by using the connected network card, A socket connection is established to the listening socket.
  • the device further includes:
  • the data transmission unit 30 is configured to: when the system service of the first system device or the second system device needs to communicate, connect the data through the corresponding socket connection through the daemon of the system device, and the guard of another system device. The system service that the process sends to another system device.
  • the device further includes:
  • the file descriptor setting unit 40 is configured to set a file descriptor of a socket connection between the first system device and the second system device before data transmission.
  • the data transmission between the daemon process of the first system device and the daemon process of the second system device is blind forwarding.
  • each unit is performed by establishing a socket connection between the first daemon of the first system device and the second daemon of the second system device; establishing the system of the first system device a socket connection between the service and the first daemon, and a socket connection between the system service of the second system device and the second daemon, and finally establishing a socket-based connection between the two systems
  • the data channel of the word connection, the data transmission based on the data connection of the socket connection is good, and the security is improved.
  • the safety factor is improved while improving data transmission efficiency.
  • data transmission based on socket connection and file descriptor-based scheduling during data transmission improve data transmission efficiency and data channel utilization.
  • the dual system directional connection device provided in the above embodiments may perform the dual system directional connection method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for performing the method.
  • the dual system directional connection device provided in the above embodiments, and has corresponding functional modules and beneficial effects for performing the method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明公开了一种双系统定向连接的方法和装置。该方法包括:建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,通过该方法最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高了安全系数,同时提高了数据传输效率。

Description

双系统定向连接的方法和装置 技术领域
本发明涉及智能终端领域,尤其涉及一种双系统定向连接的方法和装置。
背景技术
现有的许多交互设备为提高设备软硬件升级的便利性和系统架构的稳定性,常采用两个Android系统设备,其中一个Android系统设备用于实现对交互设备的显示等基本需求;另一个Android系统设备用于实现交互设备与用户之间的交互。
在Android双系统方案中,为了在两个系统之间进行通信,以Android-A作为host,Android-B作client,在Android-A上通过ADB(Android Debug Bridge,Android调试桥)连接至B并发送指令。当B需要向A发送消息时,则以日志文件的方式输出,A通过解析日志文件得到B的消息。
如果第三方应用知道了B向A回传数据的格式,将对其安全性造成很大的威胁。此外,解析日志文件的过程效率也较为低下。
发明内容
本发明提供一种双系统定向连接的方法和装置,以消除现有技术中双系统数据传输的安全隐患,提高数据处理的效率。
第一方面采用一种双系统定向连接的方法,包括:
建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的 套接字连接;
建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
其中,所述建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接,包括:
启动所述第一系统设备的第一守护进程,第一守护进程通过ADB以所述第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程;
第一守护进程生成套接字连接的监听套接字,将所述套接字连接绑定到所述第一系统设备的IPv6地址以及所述第一系统设备和第二系统设备直接连接的物理网卡;
由所述第二守护进程根据所述启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向所述IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
其中,所述建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接之后,还包括:
当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务。
其中,所述当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务之前,还包括:
设置所述第一系统设备和第二系统设备之间的套接字连接的文件描述符。
其中,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据发送为盲转发。
第二方面采用一种双系统定向连接的装置,包括:
第一建立单元,用于建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;
第二建立单元,用于建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
其中,所述第一建立单元,包括:
守护进程启动模块,用于启动所述第一系统设备的第一守护进程,第一守护进程通过ADB以所述第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程;
网卡连接模块,用于通过第一守护进程生成套接字连接的监听套接字,将所述套接字连接绑定到所述第一系统设备的IPv6地址以及所述第一系统设备和第二系统设备直接连接的物理网卡;
套接字连接模块,用于由所述第二守护进程根据所述启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向所述IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
其中,所述装置,还包括:
数据传输单元,用于当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另 一系统设备的守护进程发送到另一系统设备的系统服务。
其中,所述装置,还包括:
文件描述符设置单元,用于数据传输之前设置所述第一系统设备和第二系统设备之间的套接字连接的文件描述符。
其中,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据发送为盲转发。
本发明通过建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高了安全系数,同时提高了数据传输效率。
附图说明
图1是本发明实施例一中的双系统定向连接的方法的流程图;
图2A是本发明实施例二中的双系统定向连接的方法的流程图;
图2B是本发明实施例二中的双系统定向连接的数据通道的示意图;
图3是本发明实施例三中的双系统定向连接的装置的结构示意图;
图4是本发明实施例四中的双系统定向连接的装置的结构示意图。
具体实施方式
下面结合附图并通过具体实施方式来进一步说明本发明的技术方案。可以 理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。
在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各步骤描述成顺序的处理,但是其中的许多步骤可以被并行地、并发地或者同时实施。此外,各步骤的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。
实施例一
图1为本发明实施例一提供的一种双系统定向连接的方法的流程图。本实施例的方法可以通过硬件和/或软件的方式实现,并一般可独立的配置在终端设备的应用端内中实现本实施例的方法。
其中,应用端可以为内嵌于用户终端中的某个客户端的插件,或者为所述用户终端的操作系统的插件,与内嵌于用户终端中的文本编辑类客户端(例如,记事本或者编辑器等)配合使用;应用端也可以为所述用户终端中一个独立的可提供文本编辑服务的客户端,本实施例对此不进行限制。
S11、建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接。
现有技术中,第一系统设备和第二系统设备间的数据传输以单向传输为主,如果要实现双向的数据传输则过程比较复杂,并数据传输的速度比较慢。
在本方案中,分别在两个系统设备建立用于对两个系统设备间的数据传输 进行调度管理的守护进程,守护进程在系统的后台进行独立运行,两个守护进程之间以套接字的方式进行数据传输。
第一系统设备的第一守护进程可以根据设定的参数启动第二系统设备的第二守护进程,根据设定的参数以及第一守护进程和第二守护进程之间的请求和返回建立第一系统设备和第二系统设备之间的套接字连接。
S12、建立第一系统设备的系统服务与第一守护进程之间的套接字连接,以及第二系统设备的系统服务与第二守护进程之间的套接字连接。
对于系统设备而言,系统服务是外层交互与内层数据处理之间的节点,本方案中,两个系统设备分别建立系统服务与各自的守护进程之间的套接字连接,在用户交互过程中的数据通过套接字连接在系统服务与守护进程之间进行传输,最终,两个系统设备之间有数据发送的需要时,依次通过自身的系统服务与守护进程间的套接字、守护进程与守护进程之间的套接字连接以及另一系统的守护进程与系统服务之间的套接字连接形成的数据通道,实现从一个系统服务到另一个系统服务的数据传输。
综上所述,本实施例的技术方案,通过建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高了安全系数,同时提高了数据传输效率。
实施例二
图2A为本发明实施例二提供的双系统定向连接的方法的流程图,如图所示,该方法包括:
步骤S21、启动第一系统设备的第一守护进程,第一守护进程通过ADB以第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程。
交互设备中的第一系统设备和第二系统设备的初始连接方式为ADB,ADB主要是用于单向传输,本方案中将数据的发起端定义为第一系统设备,数据的接收端定义为第二系统设备。在建立本方案中的定向连接时,首先启动第一守护进程,守护进程可以由用户自行定义执行预定功能,本方案中的第一守护进程和第二守护进程用于建立第一系统设备和第二系统设备的定向连接。
步骤S22、第一守护进程生成套接字连接,将套接字连接绑定到第一系统设备的IPv6地址以及第一系统设备和第二系统设备直接连接的物理网卡。
与ADB不同,套接字连接的物理连接由网卡实现,连接的基础参数是第一系统设备的IPv6地址,第一守护进程将套接字连接绑定到第一系统的IPv6地址,同时连接到第一系统设备和第二系统设备的网卡,建立第一守护进程和第二守护进程的初始连接。
步骤S23、由第二守护进程根据启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
上述第一系统设备和第二系统设备的套接字的建立过程具体而言,第一系统设备完成套接字连接建立的初始设置,并将自身的物理地址通过ADB发送到第二系统设备并激活第二系统设备的守护进程;第二守护进程根据相关参数确认第一系统设备的IPv6地址,并通过已连接的网卡发起主动的套接字连接请求, 第一系统设备根据监听套接字对第二守护进程发起的套接字连接请求的监听结果建立套接字连接。
步骤S24、建立第一系统设备的系统服务与第一守护进程之间的套接字连接,以及第二系统设备的系统服务与第二守护进程之间的套接字连接。
最终形成的数据通道如图2B所示,第一系统设备50的系统服务51与第一守护进程52之间的套接字连接直接根据预留的通讯端口建立即可,第二系统设备60的系统服务61与第二守护进程62之间的套接字连接的建立过程类似,再加上已建立的第一守护进程52和第二守护进程62之间的套接字连接,形成基于套接字连接的数据通道。
步骤S25、设置第一系统设备和第二系统设备之间的套接字连接的文件描述符。
在本方案中建立的定向连接中,数据通道I/O复用,为保证数据传输过程中对套接字连接的有效调度,可以通过poll函数监听数据通道的文件描述符,并可以对文件描述符进行设置。在监听过程中,如果监听到文件描述为休眠,则发送命令给另外一个系统设备,以维持连接;如果监听到文件描述为可“读”,则通过套接字连接读取接收到的数据,并设置poll的参数,表示对“写”感兴趣;如果监听到文件描述为可“写”,则通过套接字连接写数据进行传输,如果保存待写入数据的缓存区已清空,则设置poll的参数,表示对“写”不感兴趣,如果保存待写入数据的缓存区一次未发送完,则继续监听文件描述符,直到数据传输完成。
步骤S26、当第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的 守护进程发送到另一系统设备的系统服务。
具体到数据传输过程,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据以盲转发的方式通过各个套接字连接依次发送。系统设备将自身最先建立的数据传输任务对应的数据最先发送出去,发送的数据块数目就等于数据传输任务建立时的数据块的数目。
综上所述,本实施例的技术方案,通过建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高了安全系数,同时提高了数据传输效率。同时,基于套接字连接的数据传输以及数据传输过程中基于文件描述符的调度提高了数据传输的效率以及数据通道的利用率。
实施例三
图3所示为本发明实施例三提供的双系统定向连接的装置的结构示意图,该装置可通过硬件和/或软件的方式实现,并一般可独立的配置在终端设备的实现本实施例的装置。如图3所示,所述双系统定向连接的装置具体包括:第一建立单元和第二建立单元12;
第一建立单元10和第二建立单元20;
第一建立单元10,用于建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;
第二建立单元20,用于建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
综上所述,上述各单元的协同运转,通过建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高了安全系数,同时提高了数据传输效率。
实施例四
图4所示为本发明实施例四提供的双系统定向连接的装置的结构示意图,该装置可通过硬件和/或软件的方式实现,并一般可独立的配置在终端设备的实现本实施例的装置。如图4所示,所述双系统定向连接的装置具体包括:第一建立单元10和第二建立单元20;
第一建立单元10,用于建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;
第二建立单元20,用于建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
其中,所述第一建立单元10,包括:
守护进程启动模块11,用于启动所述第一系统设备的第一守护进程,第一 守护进程通过ADB以所述第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程;
网卡连接模块12,用于通过第一守护进程生成套接字连接,将所述套接字连接绑定到所述第一系统设备的IPv6地址以及所述第一系统设备和第二系统设备直接连接的物理网卡;
套接字连接模块13,用于由所述第二守护进程根据所述启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向所述IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
其中,所述装置,还包括:
数据传输单元30,用于当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务。
其中,所述装置,还包括:
文件描述符设置单元40,用于数据传输之前设置所述第一系统设备和第二系统设备之间的套接字连接的文件描述符。
其中,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据发送为盲转发。
综上所述,上述各单元的协同运转,通过建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接,最终建立双系统之间基于套接字连接的数据通道,基于套接字连接的数据通道数据传输的保密性好,提高 了安全系数,同时提高了数据传输效率。同时,基于套接字连接的数据传输以及数据传输过程中基于文件描述符的调度提高了数据传输的效率以及数据通道的利用率。
上述实施例中提供的双系统定向连接的装置可执行本发明任意实施例所提供的双系统定向连接的方法,具备执行该方法相应的功能模块和有益效果。未在上述实施例中详尽描述的技术细节,可参见本发明任意实施例所提供的双系统定向连接的方法。
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。

Claims (10)

  1. 一种双系统定向连接的方法,其特征在于,包括:
    建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;
    建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
  2. 根据权利要求1所述的方法,其特征在于,所述建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接,包括:
    启动所述第一系统设备的第一守护进程,第一守护进程通过ADB以所述第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程;
    第一守护进程生成套接字连接的监听套接字,将所述套接字连接绑定到所述第一系统设备的IPv6地址以及所述第一系统设备和第二系统设备直接连接的物理网卡;
    由所述第二守护进程根据所述启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向所述IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
  3. 根据权利要求1所述的方法,其特征在于,所述建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接之后,还包括:
    当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务。
  4. 根据权利要求3所述的方法,其特征在于,所述当所述第一系统设备或 第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务之前,还包括:
    设置所述第一系统设备和第二系统设备之间的套接字连接的文件描述符。
  5. 根据权利要求3所述的方法,其特征在于,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据发送为盲转发。
  6. 一种双系统定向连接的装置,其特征在于,包括:
    第一建立单元,用于建立第一系统设备的第一守护进程和第二系统设备的第二守护进程之间的套接字连接;
    第二建立单元,用于建立所述第一系统设备的系统服务与所述第一守护进程之间的套接字连接,以及所述第二系统设备的系统服务与所述第二守护进程之间的套接字连接。
  7. 根据权利要求6所述的装置,其特征在于,所述第一建立单元,包括:
    守护进程启动模块,用于启动所述第一系统设备的第一守护进程,第一守护进程通过ADB以所述第一系统设备的物理地址作为启动参数启动第二系统设备的第二守护进程;
    网卡连接模块,用于通过第一守护进程生成套接字连接的监听套接字,将所述套接字连接绑定到所述第一系统设备的IPv6地址以及所述第一系统设备和第二系统设备直接连接的物理网卡;
    套接字连接模块,用于由所述第二守护进程根据所述启动参数确认第一系统设备的IPv6地址,并通过已连接的网卡向所述IPv6地址发起主动的套接字连接,以向所述监听套接字确认建立套接字连接。
  8. 根据权利要求6所述的装置,其特征在于,所述装置,还包括:
    数据传输单元,用于当所述第一系统设备或第二系统设备的系统服务需要进行通信时,将数据通过对应的套接字连接依次经由系统设备的守护进程、另一系统设备的守护进程发送到另一系统设备的系统服务。
  9. 根据权利要求8所述的装置,其特征在于,所述装置,还包括:
    文件描述符设置单元,用于数据传输之前设置所述第一系统设备和第二系统设备之间的套接字连接的文件描述符。
  10. 根据权利要求8所述的装置,其特征在于,所述第一系统设备的守护进程和第二系统设备的守护进程之间的数据发送为盲转发。
PCT/CN2017/077309 2016-12-22 2017-03-20 双系统定向连接的方法和装置 Ceased WO2018113114A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611196639.7 2016-12-22
CN201611196639.7A CN106850554B (zh) 2016-12-22 2016-12-22 双系统定向连接的方法和装置

Publications (1)

Publication Number Publication Date
WO2018113114A1 true WO2018113114A1 (zh) 2018-06-28

Family

ID=59135231

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/077309 Ceased WO2018113114A1 (zh) 2016-12-22 2017-03-20 双系统定向连接的方法和装置

Country Status (2)

Country Link
CN (1) CN106850554B (zh)
WO (1) WO2018113114A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764965A (zh) * 2019-09-04 2020-02-07 深圳壹账通智能科技有限公司 进程守护方法、装置、电子设备及存储介质
CN113014679B (zh) * 2019-12-19 2022-11-01 成都鼎桥通信技术有限公司 通信方法、装置及系统
CN111338826B (zh) * 2020-02-28 2021-02-02 北京嘀嘀无限科技发展有限公司 一种电子设备以及设备联动控制系统、方法
CN112817718B (zh) * 2021-01-28 2025-01-14 京东方科技集团股份有限公司 双系统设备及其应用展示方法、存储介质
CN119556994A (zh) * 2023-09-01 2025-03-04 中兴终端有限公司 双系统控制方法、电子设备和计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2530995A1 (en) * 2010-08-11 2012-12-05 ZTE Corporation Method and apparatus for implementing network device function of wireless communication terminal
CN103902389A (zh) * 2014-03-06 2014-07-02 厦门雅迅网络股份有限公司 基于android平台的支持双向通信的设备管理方法
CN104317661A (zh) * 2014-11-04 2015-01-28 上海斐讯数据通信技术有限公司 嵌入式双系统的系统间通信方法及装置
CN105260250A (zh) * 2015-09-10 2016-01-20 烽火通信科技股份有限公司 一种Linux系统与Android系统的双系统通信装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2530995A1 (en) * 2010-08-11 2012-12-05 ZTE Corporation Method and apparatus for implementing network device function of wireless communication terminal
CN103902389A (zh) * 2014-03-06 2014-07-02 厦门雅迅网络股份有限公司 基于android平台的支持双向通信的设备管理方法
CN104317661A (zh) * 2014-11-04 2015-01-28 上海斐讯数据通信技术有限公司 嵌入式双系统的系统间通信方法及装置
CN105260250A (zh) * 2015-09-10 2016-01-20 烽火通信科技股份有限公司 一种Linux系统与Android系统的双系统通信装置

Also Published As

Publication number Publication date
CN106850554B (zh) 2019-12-17
CN106850554A (zh) 2017-06-13

Similar Documents

Publication Publication Date Title
CN107463499B (zh) Adb远程连接方法、装置、设备及存储介质
WO2018113114A1 (zh) 双系统定向连接的方法和装置
CN106161537B (zh) 远程过程调用的处理方法、装置、系统及电子设备
US6687817B1 (en) Configuration of a network device via the network
CN107634984B (zh) 一种基于单向传输通道的文件同步方法
CN105100232A (zh) 一种不中断服务的服务端程序平滑升级的方法
CN103577209A (zh) 一种基于嵌入式设备的应用程序远程在线调试方法及装置
WO2014183556A1 (zh) 应用程序的处理方法和装置
WO2022227818A1 (zh) 用于配网的方法、装置和智能家居设备
CN103927256A (zh) 一种控制多个安卓装置的方法
US20170034311A1 (en) Method for selecting between multiple RPC frameworks during a TCP/IP session
CN106776398A (zh) 双系统双向控制的方法和装置
CN114619462A (zh) 一种基于机器人流程自动化的远程桌面控制方法
CN110062054A (zh) 物联网设备远程控制方法及系统
CN115623057A (zh) 基于rdma的建连方法、装置、设备及存储介质
CN109951308A (zh) 一种路由器配置方法、装置及存储介质
WO2014169589A1 (zh) 智能终端的同步操作方法及装置
CN103607600A (zh) 云备份方法和装置
CN107277107B (zh) 应用调试方法、装置及系统
WO2021253273A1 (zh) 一种基于 WiFi 复用技术的无线传输方法和系统
CN117061270A (zh) 一种基于分布式软总线实现远程设备本地化虚拟与访问的方法
CN103973772A (zh) 文件读写方法和装置
CN106657076B (zh) 一种网络命名空间的tcp服务实现方法及装置
CN107172183A (zh) 一种统一管理用户的方法、装置及系统
CN102651777A (zh) 链路建立方法和设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17883287

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17883287

Country of ref document: EP

Kind code of ref document: A1