Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the invention are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other. The following description is made of a specific use scenario of the present invention.
With the development of communication technology, in order to improve security during use of an interface device in some scenarios, and/or use of a receiving device is not limited by a physical area, the interface device may be used through a virtualization technology (e.g., a cloud desktop). That is, the interface device not within the preset physical driving range can be remotely driven through the virtualization technology.
It is understood that the interface device may be a serial device or a parallel device. The following is a specific scenario.
Under the condition that users use the interface device to uniformly plan resources and simplify operation and maintenance of a service system, more and more users often execute operations such as interface device driving in a cloud desktop mode. Generally, the cloud desktop can be used for daily office work, government affair processing, business cloud application and the like. In these scenarios, there may be a large number of interactions between different serial devices and parallel devices, for example, the serial devices may include a serial keyboard for inputting a password used by a bank (the serial keyboard may be an all-in-one serial device for developing a service) in a case where the user is a bank, and may include a serial debugging device for development used by a software company in a case where the user is a software company, and the parallel devices may include a parallel printer, a parallel ticket printer, and the like.
To save hardware cost, a local terminal (e.g., a computer) is often used as the installation hardware of the cloud desktop corresponding client. Whether for security or for the cost of the interface device redirection process, the interface device is typically not connected to the electronic device by way of a USB wired connection, but rather by arranging the service software (e.g., service relay software) for redirection in the cloud desktop. Under the condition that the local terminal initiates a request for driving the interface device to the cloud desktop through the cloud desktop client, the request can be transmitted to the redirected service software through the cloud desktop, and then the interface device is driven through the cloud desktop.
However, since the types of the interface devices are very many, and each type includes the interface devices of different brands, each brand has a corresponding driving mode, so in order to enable all the interface devices to be connected and driven in such a redirecting mode, relay service software for sending driving instructions for driving different interface devices is set in the cloud desktop, the driving instructions for driving the interface devices are generated through the relay service software and transmitted to the electronic device where the cloud desktop client is located, and then the driving instructions are executed through the driving interfaces of the interface devices set in the electronic device, so that the interface devices are finally driven.
However, the relay service software is deployed in the cloud desktop due to the redirection technology. Therefore, in the case of network isolation between the cloud desktop and the local terminal (e.g., computer), the relay service software cannot be used, so that the redirection of the interface device cannot be performed normally, and the cloud desktop cannot drive the interface device.
Based on the above, the invention provides an interface redirection method, device, equipment and medium, which can solve the problem that the redirection technology cannot be normally used under the condition that a network of a cloud desktop for receiving a redirection request is logically isolated, and greatly improve the use scene, the use stability and the reliability of the redirection technology.
Fig. 1 is a schematic flow chart of an interface redirection method according to an embodiment of the present invention, where an execution body of the method may be a server as described above, and the server is deployed with a first relay unit, a mapping unit, and a cloud desktop. As shown in fig. 1, the method comprises the following steps 301 and 302:
Step 301, transmitting the first access request to a first relay unit through the mapping unit based on the first access request generated by the cloud desktop.
In the embodiment of the present invention, the first access request is used to instruct the second relay unit corresponding to the cloud desktop client to access the target device.
In the embodiment of the invention, the cloud desktop is deployed in a server in advance.
In the embodiment of the invention, the cloud desktop can also be created for the virtual machine.
In the embodiment of the present invention, the target device is an interface device.
In one example, the interface device may be a parallel port device, and the interface device may also be a serial port device.
In the embodiment of the present invention, the first access request may be generated by the cloud desktop autonomously, or may be generated by the cloud desktop after receiving a request from the cloud desktop client to access the target device.
It can be understood that the process of generating the first access request is different in different scenes, in one scene, after receiving the operation that the user wants to access the target device through the cloud desktop by operating the cloud desktop client, the cloud desktop client generates a request and sends the request to the cloud desktop in the server, the cloud desktop can generate the first access request according to the request, and in another scene, the cloud desktop itself needs to access and drive the target device, the first access request can be generated autonomously.
In the embodiment of the present invention, the mapping unit is an intermediate unit configured to transmit the first access request from the cloud desktop to the first relay unit.
It will be appreciated that, as described above, the interface devices are very fast to update due to the variety and types of the interface devices, and each interface device has its own corresponding driving instruction through which the interface device can be driven. In the embodiment of the invention, when the target equipment positioned at one side of the local terminal needs to be driven by the cloud desktop, the driving instruction which can be executed by the target equipment needs to be generated. Based on this, it is possible to provide a mapping unit with which a first access request is transmitted, one mapping unit corresponding to one target device, with which the first access request is transmitted, which first access request can be executed by the target device.
In the embodiment of the present invention, the first relay unit may serve as a server interface relay.
The first relay unit may relay services for a server interface provided in the server and receiving the first access request transmitted by the mapping unit.
In one example, the first relay unit may serve as a server parallel port relay, and in another example, the first relay unit may serve as a server serial port relay.
It should be noted that one first relay unit corresponds to one target device. For example, the first relay unit is a server parallel port relay service, the server parallel port relay service corresponds to one parallel port target device, the server parallel port relay service can receive a first access request from the mapping unit and transmit the first access request to the local terminal, and finally transmit the first access request to the parallel port target device, the parallel port target device executes request content corresponding to the first access request, for example, the first relay unit is a server serial port relay service, the server serial port relay service corresponds to one serial port target device, the server parallel port relay service can receive the first access request from the mapping unit and transmit the first access request to the local terminal, and finally transmit the first access request to the serial port target device, and the serial port target device executes the request content corresponding to the first access request.
In the embodiment of the present invention, a connection manner of a network socket exists between the first relay unit and the mapping unit.
In the embodiment of the present invention, the mapping unit has a function of mapping the first access request in the cloud desktop to the mapping unit, and transmitting the first access request to the first relay unit through a network socket between the first relay unit and the mapping unit, which is described in detail later, and will not be repeated herein.
In the embodiment of the present invention, a network socket between the mapping unit and the cloud desktop is pre-established.
Alternatively, in an embodiment of the present invention, different mapping units indicate different target devices.
Similar to the foregoing correspondence between one first relay unit and one target device, in the embodiment of the present invention, one mapping unit corresponds to one target device.
For example, one mapping unit corresponds to one parallel device, and for example, one mapping unit corresponds to one serial device.
It will be appreciated that the network socket between the mapping unit and the cloud desktop is a network socket with a mapping function, i.e. in case the first access request is generated in the cloud desktop, the network socket will map the first access request directly into the mapping unit based on the network socket with the mapping function.
In the embodiment of the present invention, the mapping unit may be a PTS device file.
It is understood that the above PTS device files are pre-established.
Further, the PTS device file has a step of directly mapping the first access request in the cloud desktop into the PTS device file, and then executing a subsequent step of transmitting the first access request by the PTS device through a network socket between the PTS device and the first relay unit.
Step 302, transmitting, by the first relay unit, the first access request to the second relay unit.
In the embodiment of the present invention, the second relay unit and the cloud desktop client are disposed on the same local terminal.
In the embodiment of the present invention, the first relay unit and the second relay unit are connected through a network socket. The network socket connection mode between the first relay unit and the second relay unit is pre-established.
It can be understood that, after the first access request is transmitted to the second relay terminal, the target device located at the local terminal side may execute the request content of the first access request according to the first access request, which is specifically referred to the following description and will not be repeated herein.
Optionally, in the embodiment of the present invention, a mapping relationship exists between the cloud desktop and the mapping unit, and the transmitting of the first access request to the first relay unit through the mapping unit based on the first access request generated by the cloud desktop includes driving an interface driver in the cloud desktop based on an access instruction generated by the cloud desktop, generating the first access request by the interface driver, mapping the first access request to the mapping unit, and transmitting the first access request to the first relay unit through the mapping unit.
For example, in the cloud desktop described above, an interface driver for driving an interface in the cloud desktop may be deployed in advance.
In one example, the interface driver may be a parallel driver or a serial driver.
The interface driver may be driven by an application corresponding to the interface driver, for example.
In one example, when the interface driver is a parallel driver, the application corresponding to the interface driver is a parallel application, and correspondingly, when the interface driver is a serial driver, the application corresponding to the interface driver is a serial application.
Further, in the case that an interface driver is pre-deployed in the cloud desktop, a mapping relationship exists between the mapping unit and the interface driver.
It can be understood that the cloud desktop can generate an access instruction for driving the parallel port driver or the serial port driver under the condition that the target device needs to be driven, the interface driver can be driven by the access instruction, and then the interface driver directly generates the first access request.
As shown in fig. 2, the server 21 is included in fig. 2, and the server 21 includes a first relay unit, where the first relay unit is a server serial port relay service 22 and a server parallel port relay service 23, respectively, the server serial port relay service 22 corresponds to a serial port device 31 on the local terminal 30 side, and the server parallel port relay service 23 corresponds to a parallel port device 32 on the local terminal 30 side. The server also comprises a cloud desktop 24, and the cloud desktop 24 comprises a serial application program A1 and a serial driver A2, and a parallel application program B1 and a parallel driver B2.
The server 21 further includes a PTS device file 25 and a PTS device file 26, where a mapping connection relationship 101 of a network socket exists between the PTS device 25 and a serial port driver A2 in the cloud desktop 24, and correspondingly, a mapping connection relationship 201 of a network socket exists between the PTS device 26 and a parallel port driver B2 in the cloud desktop 24.
A connection relationship 102 of a web socket exists between the PTS device file 25 and the server serial port relay service 22, and a connection relationship 202 of a web socket exists between the PTS device file 26 and the server parallel port relay service 23.
Further, the second relay unit includes a client serial port relay service 33 and a client parallel port relay service 34, the server serial port relay service 22 and the client serial port relay service 33 have a connection relationship 103 of a network socket, and the server parallel port relay service 23 and the client parallel port relay service 34 have a connection relationship 203 of a network socket.
In the method provided by the embodiment of the invention, a first relay unit, a mapping unit and a cloud desktop are deployed in a server, based on a first access request generated by the cloud desktop, the first access request for indicating a second relay unit corresponding to a cloud desktop client to access a target device can be transmitted to the first relay unit through the mapping unit, and then the first access request is sent to the second relay unit through the first relay unit (the second relay unit and the cloud desktop client are deployed in the same local terminal). Therefore, the first relay unit for transmitting the first access request for accessing the target device is arranged outside the cloud desktop, and the first relay unit and the cloud desktop are both arranged in the server, so that the driving instruction of the cloud desktop to the target device is not influenced under the condition that logic isolation is generated between the cloud desktop and the cloud desktop client, and the driving technology for driving the target device through the cloud desktop can still be normally used.
In another embodiment of the present invention, a specific implementation of the transmission procedure of the first access request between the first relay unit and the second relay unit is also provided. The specific implementation of the foregoing "sending the first access request to the second relay unit corresponding to the cloud desktop client through the first relay unit" includes, for example, confirming a first communication state between the mapping unit and the first relay unit and a second communication state between the first relay unit and the second relay unit, and sending the second access request to the second relay unit corresponding to the cloud desktop client through the first relay unit when the first communication state and the second communication state are in a target matching state.
The first communication state includes a readable state or a writable state, and the second communication state includes a readable state or a writable state.
The target matching state includes, for example, the first communication state being a readable state and the second communication state being a writable state, or the first communication state being a writable state and the second communication state being a readable state.
It will be appreciated that for the first relay unit it is necessary to receive, read and transmit the first access request from the mapping unit to the second relay unit, i.e. if the first relay unit is able to transmit the first access request, the communication state between the mapping unit and the first relay unit and the communication state between the first relay unit and the second relay unit should be guaranteed to be mutually matched.
Further, the above-mentioned matching states are explained as follows, in which the first relay unit is connected to the mapping unit and is also connected to the second relay unit, so that the communication direction may include transmitting information from the mapping unit to the first relay unit and then transmitting information from the first relay unit to the second relay unit, and the communication direction may further include transmitting information from the second relay unit to the first relay unit and then transmitting information from the first relay unit to the mapping unit. Based on this, the communication states that need to be acquired for the network connection between the different units are also different for the different communication directions.
The communication direction is that the mapping unit transmits information to the first relay unit, the first relay unit transmits information to the second relay unit, the communication state between the mapping unit and the first relay unit needs to be confirmed to be in a readable state, and the communication state between the first relay unit and the second relay unit is in a writable state.
In connection with fig. 2, it may be confirmed that the first access request may be transmitted by confirming that the connection relationship 102 of the network socket exists between the PTS device file 25 and the server serial port relay service 22 is in a readable state, and simultaneously, the connection relationship 103 of the network socket exists between the server serial port relay service 22 and the client serial port relay service 33 is in a writable state, or that the connection relationship 202 of the network socket exists between the PTS device file 26 and the server parallel port relay service 23 is in a writable state, and simultaneously, the connection relationship 203 of the network socket exists between the server parallel port relay service 23 and the client parallel port relay service 34 is in a readable state.
In another embodiment of the invention, a specific implementation of specifically determining the listening occasion is also provided. In the foregoing "sending the first access request to the second relay unit through the first relay unit", the method further includes the first relay unit monitoring a first communication connection request sent by the second relay unit to the first relay unit, monitoring the mapping unit through the first relay unit and monitoring the second relay unit when the first relay unit monitors the first communication connection request, and obtaining the first access request from the mapping unit and sending the first access request to a second relay unit corresponding to the cloud desktop client through the first relay unit when the first relay unit monitors the first communication connection request, and monitoring a first communication state between the first relay unit and the mapping unit and when the second communication state between the first relay unit and the second relay unit changes.
It will be appreciated that, as described above, the first relay unit and the second relay unit are connected to each other by a network via a network socket. In one example, the network socket connection is a TCP snoop connection. And under the condition that the first relay unit receives a connection request initiated by the second relay unit, the first relay unit starts network socket connection with the second relay unit and starts state monitoring on connection channels at two sides of the first relay unit.
The first relay unit may monitor the timing and communication status of the transmission of the first access request through a network socket between the first relay unit and the mapping unit and a network socket between the first relay unit and the second relay unit.
Specifically, whether the first access request exists in the cloud desktop can be determined by monitoring whether the communication states of the connection channels at two sides meet the target matching state, and the first access request is transmitted under the condition that the first access request exists in the cloud desktop is determined.
Optionally, in the embodiment of the invention, the interface redirection method further comprises the steps of transmitting a monitoring file between the first relay unit and the cloud desktop, and monitoring the cloud desktop according to a feedback file of the monitoring file.
It can be understood that, in the embodiment of the present invention, in the process of monitoring the connection channels on both sides of the first relay unit, the monitoring file may be transmitted in the connection channels on both sides, and the communication states of the connection channels on both sides may be determined by transmitting the monitoring file in the connection channels on both sides and by the feedback file of the monitoring file in the connection channels on both sides.
In one example, the snoop file may include a poll descriptor in a non-blocking manner. After the polling descriptors are respectively sent to the mapping unit and the second relay unit by the first relay unit through the connection channels at two sides, the feedback polling descriptors are changed, and the polling descriptors indicate that the communication state between the mapping unit and the first relay unit is in a readable state and the communication state between the first relay unit and the second relay unit is in a writable state, or indicate that the communication state between the mapping unit and the first relay unit is in a writable state and the communication state between the first relay unit and the second relay unit is in a readable state, so that the first mapping request exists at the cloud desktop at the moment, and the first relay unit needs to transmit the first mapping request.
Optionally, in the embodiment of the present invention, the first relay unit receives a second access request sent by the second relay unit, where the second access request is used to instruct the first relay unit to access the target device, sends the second access request to an interface driver of the local terminal, and transmits, by using the mapping unit, request content corresponding to the second access request to the cloud desktop.
It can be understood that in the embodiment of the present invention, there is also a case where the cloud desktop itself actively drives the target device, for example, the cloud desktop needs to acquire query information of the target device. In this case, the local terminal is required to transmit a second access request containing data to the server. In this process, the first relay unit in the server is connected to the second relay unit of the local terminal, so that the second access request sent by the second relay unit is received by the first relay unit, and is transmitted to the cloud desktop by the first relay unit through the mapping unit.
As shown in fig. 2, the second relay unit includes a client serial port relay service 33 and a client parallel port relay service 34, the client serial port relay service 33 transmits the second access request through a connection relationship 103 with a network socket between the server serial port relay service 22, or the client parallel port relay service 34 transmits the second access request through a connection relationship 203 with a network socket between the server parallel port relay service 23.
After that, the server serial port relay service 22 transmits the request content of the second access request to the cloud desktop through the PTS device file, or the server parallel port relay service 23 transmits the request content of the second access request to the cloud desktop through the PTS device file.
The embodiment of the invention also provides an interface redirection method, which is applied to a local terminal, wherein the local terminal is provided with a second relay unit and a cloud desktop client, and in the embodiment of the invention, the interface redirection method comprises the following steps 401 and 402:
step 401, receiving, by the second relay unit, a first access request, where the first access request is used to instruct the second relay unit to access a target device.
Step 402, driving the target device according to the request content of the first access request and executing the instruction corresponding to the request content.
In the embodiment of the present invention, the second relay unit, the cloud desktop client, the first access request, and the target device may refer to the foregoing contents, and are not repeated herein.
It will be appreciated from the foregoing that there is a connection between the first relay unit and the second relay unit that is a network socket, and therefore, after the second relay unit receives the first access request, the target device indicated by the first access request may be driven based on the first access request, so that the target device performs the request.
As shown in fig. 2, the second relay unit includes a client serial port relay service 33 and a client parallel port relay service 34, the client serial port relay service 33 receives the first access request through a connection relationship 103 with a network socket between the server serial port relay service 22, or the client parallel port relay service 34 receives the first access request through a connection relationship 203 with a network socket between the server parallel port relay service 23.
After that, the client serial port relay service 33 drives the serial port device 31 to execute the request content of the access request, or the client parallel port relay service 34 drives the parallel port device 32 to execute the request content of the access request.
According to the method, the device and the system, the second relay unit and the cloud desktop client are distributed in the local terminal, after the second relay unit receives the first access request for indicating the second relay unit to access the target device, the target device is driven according to the request content of the first access request, and the instruction corresponding to the request content is executed. Thus, after receiving the first access request, the second relay unit of the local terminal can timely drive the target device according to the access request, and the redirection technology of the target device is completed according to the access request.
Optionally, in the embodiment of the present invention, the interface redirection method disclosed in the present invention further includes transmitting, based on a second access request generated by the cloud desktop client, the second access request to the second relay unit, and sending, by the second relay unit, the second access request to a first relay unit in the server.
In the embodiment of the present invention, the second access request is used to instruct the first relay unit to access the target device.
In the embodiment of the present invention, the first relay unit and the cloud desktop are disposed on the same server.
It will be appreciated that in the embodiment of the present invention, the redirection technique is a bidirectional data transmission technique, and may be used to redirect data (e.g. the first access request) from the server to the local terminal, or redirect data (e.g. the second access request) from the local terminal to the server. The foregoing describes a process of redirecting data from a local terminal to a server.
The second access request generated by the cloud desktop client may be generated autonomously or by an interface device file connected to the cloud desktop client.
In one example, the interface device file may be a serial device file or a parallel device file.
In one example, the interface device file may be a/dev/lp file.
It will be appreciated that the above-mentioned interface device file may be communicatively coupled to the interface device on the one hand, and to the second relay unit on the other hand, i.e. the interface device file is arranged between the second relay unit and the interface device.
Illustratively, one interface device file corresponds to one interface device. Different interface device files correspond to different interface devices.
In one example, one parallel device corresponds to one parallel device file and one serial device corresponds to one serial device file.
Illustratively, one interface device corresponds to one second relay unit. The different interface devices correspond to different second relay units.
In one example, one parallel device corresponds to one second relay unit, and one serial device corresponds to one second relay unit.
As shown in fig. 2, a client serial port relay service 33 is in communication connection with a serial port device file 35, and the serial port device file 35 is in communication connection with a serial port device 31, a client parallel port relay service 34 is in communication connection with a parallel port device file 36, and the parallel port device file 36 is in communication connection with a parallel port device 32
The following describes, by way of two examples, the above-described procedure of transmitting an access request and driving a target device in the embodiment of the present invention.
Example 1a first access request is transmitted by a server to a local terminal, such that a target device executes the first access request.
As shown in fig. 2, the reference numerals in fig. 2 are as described above, and it is to be understood that the PTS device files 25 (i.e. mapping units) in the server 21, the cloud desktop 24, and the server serial port relay service 22 are all deployed in advance in the server 21.
Before starting to execute the transmission process of the cloud desktop transmission first access request from the server to the local terminal, a network connection needs to be established. The process of establishing a network connection is described first:
Step S101 of opening the PTS device file 25 and creating a mapping connection between the PTS device file 25 and the network socket of the server serial port relay service 22. Specifically, the file descriptor of the PTS device file 25 is fd1, and the file descriptor fd2 of the server serial relay service 22. The data written to the PTS device file 25 in this mapping connection will be mapped to the web socket to the server serial port relay service 22 and the data received by the web socket of the server serial port relay service 22 will be sent to the PTS device file 25.
Step S102, based on the file descriptor fd2 of the server serial port relay service 22, a TCP monitoring connection between the server serial port relay service 22 and the client serial port relay service 33 is created, and a connection request of a network socket from the client serial port relay service 33 is received.
After the network connection is established, the transmission process of transmitting the first access request from the server to the local terminal through the cloud desktop is started
Step 101, updating the monitoring event corresponding to the file descriptor fd1 and the file descriptor fd2, monitoring the communication state of the connection channel between the client serial port relay service 33 and the server serial port relay service 22, and the communication state of the connection channel between the server serial port relay service 22 and the PTS device file 25, judging whether the read-write state changes, and monitoring by polling the file by the server serial port relay service 22 in a non-blocking manner.
Step 102, judging the respective read-write states of the two connection channels under the condition that the communication states of the connection channels between the client serial port relay service 33 and the server serial port relay service 22 and the communication states of the connection channels between the server serial port relay service 22 and the PTS equipment file 25 are changed.
The following description will be made on the two data transmission directions by respectively passing through the step 103a and the step 104a, and the step 103b and the step 104b, where the step 103a and the step 104a correspond to one data transmission direction, and the step 103b and the step 104b correspond to the other data transmission direction, because the data transmission directions may exist in the listening process of the read-write event.
Step 103a, if the communication state of the connection channel between the client serial port relay service 33 and the server serial port relay service 22 is a writable state, and the communication state of the connection channel between the server serial port relay service 22 and the PTS device file 25 is a readable state, it is indicated that the cloud desktop has data to write into the serial port driver.
Step 104a, reading the first access request corresponding to the data in the cloud desktop mapping to the PTS device file from the PTS device file 25, caching the first access request to a buffer, and writing the first access request from the buffer into a connection channel between the client serial port relay service 33 and the server serial port relay service 22.
Step 103b, if the communication state of the connection channel between the server serial port relay service 22 and the PTS device file 25 is writable, and the communication state of the connection channel between the client serial port relay service 33 and the server serial port relay service 22 is readable, it is indicated that the client serial port relay service 33 has a data writing serial port driver.
Step 104b, reading the first access request from the connection channel between the client serial port relay service 33 and the server serial port relay service 22, caching the first access request in the buffer, and writing the first access request from the buffer into the connection channel between the server serial port relay service 22 and the PTS device file 25.
Step 105, resetting the state, turning to step 101, updating the monitoring event, and entering the next reading and writing state monitoring cycle.
And secondly, transmitting a second access request to the server by the local terminal so that the target device executes the second access request.
As the reference numerals in fig. 2 are as described above, it will be understood that the client parallel port relay service 34 provided in the local terminal 30 is deployed in advance in the local terminal 30, and the parallel port device 32 is directly connected to the local terminal.
The network connection needs to be established before the transmission process of the second access request from the local terminal 30 to the cloud desktop 24 starts to be performed by the client parallel relay service 34 in the local terminal. The process of establishing a network connection is described first:
Step S201, opening the parallel port device file 36, and creating a mapping connection between the PTS device file 35 and the network socket of the client parallel port relay service 34. Specifically, the file descriptor of the parallel port device file 36 is fd3, and the file descriptor fd4 of the client parallel port relay service 34. In the mapping connection, data received by the network socket of the client parallel port relay service 34 is sent to the parallel port device 32, and data written to the parallel port device 32 is sent to the network socket of the client parallel port relay service 34.
Step S202, creating a connection between the client parallel port relay service 34 and the server parallel port relay service 23 based on the file descriptor fd4 of the client parallel port relay service 34.
After the network connection is established, the transmission process of transmitting the second access request from the local terminal to the cloud desktop through the client is started.
Step 201, updating the monitoring event corresponding to the file descriptor fd3 and the file descriptor fd4, monitoring the communication state of the connection channel between the client parallel port relay service 34 and the server parallel port relay service 23, and the communication state of the connection channel between the client parallel port relay service 34 and the parallel port device file 36, judging whether the read-write state changes, and monitoring by polling the file by the client parallel port relay service 34 in a non-blocking manner.
Step 202, judging whether the read-write state is changed. If not, listening continues, and if a read-write event is generated, step 203 is performed.
The following description will be made on the two data transmission directions by respectively passing through the step 203a and the step 204a, and the step 203b and the step 204b, where the step 203a and the step 204a correspond to one data transmission direction, and the step 103b and the step 104b correspond to the other data transmission direction, because the data transmission directions may exist in the listening process during the read-write event.
Step 204a, if the communication state of the connection channel between the client parallel port relay service 34 and the server parallel port relay service 23 is in a writable state and the communication state of the connection channel between the client parallel port relay service 34 and the parallel port device file 36 is in a readable state, the parallel port device 32 of the local terminal 30 is said to have data to be redirected to the cloud desktop in the server.
Step 204a, reading the data from the parallel port device file 36 and transmitting the data to the client parallel port relay service 34, wherein the client parallel port relay service 34 transmits the data to the server parallel port relay service 34 due to the network connection established with the server parallel port relay service 34 through the client parallel port relay service 34 through the network socket.
Step 203b, if the communication state of the connection channel between the client parallel port relay service 34 and the server parallel port relay service 23 is in a state of availability and the communication state of the connection channel between the client parallel port relay service 34 and the parallel port device file 36 is in a state of writeable, then it is said that there is data to be redirected from the server to the parallel port device 32 of the local terminal 30.
Step 204b, reading data from the client parallel port relay service 34, transmitting the data to the parallel port device file 36, and writing the data into the parallel port device 32 by the parallel port device file.
Step 205, resetting the state, turning to step 201, updating the monitoring event, and entering the next reading and writing state monitoring cycle.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when being executed by a processor implements the training rule determining method as described in the embodiment of the invention. For example, various steps of the method shown in FIG. 1 may be performed.
Embodiments of the present invention provide a computer program product comprising instructions which, when executed by a processor, implement the steps of the method shown in fig. 1.
It should be noted that although the operations of the method of the present invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in that particular order or that all of the illustrated operations be performed in order to achieve desirable results.
Fig. 4 is a block diagram of a server according to an embodiment of the present invention. Referring to fig. 4, the server is deployed with a first relay unit 601, a mapping unit 602, and a cloud desktop 603, and:
Transmitting a first access request generated based on the cloud desktop 603 to a first relay unit 601 through the mapping unit 602, where the first access request is used to instruct the second relay unit to access the target device;
and sending the first access request to a second relay unit corresponding to the cloud desktop client through the first relay unit 601, wherein the second relay unit and the cloud desktop client are deployed on the same local terminal.
In one embodiment, the first relay unit 601 is specifically configured to:
confirming a first communication state between the mapping unit and the first relay unit, and a second communication state between the first relay unit and the second relay unit, wherein the first communication state comprises a readable state or a writable state, and the second communication state comprises a readable state or a writable state;
And under the condition that the first communication state and the second communication state are in a target matching state, sending the second access request to a second relay unit corresponding to the cloud desktop client through the first relay unit, wherein the target matching state comprises that the first communication state is a readable state and the second communication state is a writable state, or the first communication state is a writable state and the second communication state is a readable state.
In an example, a mapping relationship exists between the cloud desktop and the mapping unit, and the mapping unit 602 is specifically configured to:
Based on the access instruction generated by the cloud desktop, driving an interface driver in the cloud desktop;
the interface driver generates a first access request and maps and transmits the first access request to the mapping unit;
The first access request is transmitted to a first relay unit via the mapping unit 602.
In one example, the first relay unit 601 is specifically configured to:
Monitoring a first communication connection request sent by the second relay unit to the first relay unit;
in the case of listening to the first communication connection request, listening to the mapping unit 602 by the first relay unit and listening to a second relay unit;
And when a first communication state between the first relay unit 601 and the mapping unit 602 is monitored and a second communication state between the first relay unit and the second relay unit is changed, acquiring the first access request from the mapping unit, and sending the first access request to a second relay unit corresponding to the cloud desktop client through the first relay unit 601.
In one example, the first relay unit 601 is specifically configured to:
Transmitting a monitoring file between the first relay unit 601 and the cloud desktop 603;
and monitoring the cloud desktop 603 according to the feedback file of the monitoring file.
In one example, the first relay unit 601 is specifically configured to:
receiving a second access request sent by the second relay unit, wherein the second access request is used for indicating the first relay unit to access the target equipment;
And sending the second access request to an interface driver of the local terminal, and transmitting request content corresponding to the second access request to the cloud desktop through the mapping unit.
In the invention, a first relay unit, a mapping unit and a cloud desktop are arranged in a server, based on a first access request generated by the cloud desktop, the first access request for indicating a second relay unit corresponding to a cloud desktop client to access a target device can be transmitted to the first relay unit through the mapping unit, and then the first access request is sent to the second relay unit through the first relay unit (the second relay unit and the cloud desktop client are both arranged in the same local terminal). Therefore, the first relay unit for transmitting the first access request for accessing the target device is arranged outside the cloud desktop, and the first relay unit and the cloud desktop are both arranged in the server, so that the driving instruction of the cloud desktop to the target device is not influenced under the condition that logic isolation is generated between the cloud desktop and the cloud desktop client, and the driving technology for driving the target device through the cloud desktop can still be normally used.
Fig. 5 is a block diagram of a local terminal according to an embodiment of the present invention. Referring to fig. 5, the local terminal is deployed with a second relay unit 701 and a cloud desktop client 702, where the local terminal:
receiving, by the second relay unit 701, a first access request, where the first access request is used to instruct the second relay unit to access the target device;
And driving the target equipment according to the request content of the first access request and executing the instruction corresponding to the request content.
In an example, the cloud desktop client 702 is configured to transmit, based on a second access request generated by the cloud desktop client, the second access request to the second relay unit, where the second access request is used to instruct the first relay unit to access the target device, the second relay unit 701 is configured to send the second access request to a first relay unit in the server, and the first relay unit and the cloud desktop are deployed on the same server.
According to the method, the device and the system, the second relay unit and the cloud desktop client are distributed in the local terminal, after the second relay unit receives the first access request for indicating the second relay unit to access the target device, the target device is driven according to the request content of the first access request, and the instruction corresponding to the request content is executed. Thus, after receiving the first access request, the second relay unit of the local terminal can timely drive the target device according to the access request, and the redirection technology of the target device is completed according to the access request.
It should be understood that the units depicted in the server and the local terminal correspond to the individual steps in the method depicted in the figures. Thus, the operations and features described above for the method are equally applicable to the server and the local terminal and the units contained therein, and are not described here again. The server and the local terminal can be pre-implemented in a browser of the computer device or other security applications, or can be loaded into the browser of the computer device or the security applications thereof by means of downloading and the like. Corresponding units in the server and the local terminal may cooperate with units in the computer device to implement the solution of the embodiment of the present invention.
The division of the modules or units mentioned in the above detailed description is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
It should be noted that, for details not disclosed in the server and the local terminal in the embodiments of the present invention, please refer to details disclosed in the foregoing embodiments of the present invention, and details are not described herein.
Referring now to FIG. 6, FIG. 6 shows a schematic diagram of a computer device suitable for use in implementing embodiments of the present invention. As shown in fig. 6, the computer system 1700 includes a Central Processing Unit (CPU) 1701, which can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1702 or a program loaded from a storage section 1708 into a Random Access Memory (RAM) 1703. In the RAM1703, various programs and data required for operation instructions of the system are also stored. The CPU1701, ROM1702, and RAM1703 are connected to each other through a bus 1704. An input/output (I/O) interface 1705 is also connected to the bus 1704.
The following components are connected to an I/O interface 1705, an input section 1706 including a keyboard, a mouse, and the like, an output section 1707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 1708 including a hard disk, and the like, and a communication section 1709 including a network interface card such as a LAN card, a modem, and the like. The communication section 1709 performs communication processing via a network such as the internet. The driver 1710 is also connected to the I/O interface 1705 as needed. A removable medium 1711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 1710, so that a computer program read therefrom is installed into the storage portion 1708 as needed.
In particular, the process described above with reference to flow diagrams of fig. 1 or 3 may be implemented as a computer software program according to an embodiment of the invention. For example, embodiments of the present invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program contains program code for performing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1709, and/or installed from the removable media 1711. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 1701.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation instructions of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, blocks shown in two separate connections may in fact be performed substantially in parallel, or they may sometimes be performed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described units or modules may also be provided in a processor, for example as a processor comprising a first receiving module, a second receiving module and a transmitting module. Wherein the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
As another aspect, the present invention also provides a computer-readable storage medium that may be included in the electronic device described in the above embodiment or may exist alone without being incorporated in the electronic device. The computer readable storage medium stores one or more programs that when executed by one or more processors perform the interface redirection method described in the present invention.
The above description is only illustrative of the preferred embodiments of the present invention and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in the present invention is not limited to the specific combinations of technical features described above, but also covers other technical features which may be formed by any combination of the technical features described above or their equivalents without departing from the spirit of the disclosure. Such as the above-mentioned features and the technical features disclosed in the present invention (but not limited to) having similar functions are replaced with each other.