WO2019028673A1 - B/s architecture-based data communication system and method, web server, and monitoring system - Google Patents

B/s architecture-based data communication system and method, web server, and monitoring system Download PDF

Info

Publication number
WO2019028673A1
WO2019028673A1 PCT/CN2017/096413 CN2017096413W WO2019028673A1 WO 2019028673 A1 WO2019028673 A1 WO 2019028673A1 CN 2017096413 W CN2017096413 W CN 2017096413W WO 2019028673 A1 WO2019028673 A1 WO 2019028673A1
Authority
WO
WIPO (PCT)
Prior art keywords
communication
data
socket
server
browser
Prior art date
Application number
PCT/CN2017/096413
Other languages
French (fr)
Chinese (zh)
Inventor
宁运琨
赵国如
张咪
李慧奇
梁升云
Original Assignee
深圳先进技术研究院
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 深圳先进技术研究院 filed Critical 深圳先进技术研究院
Priority to PCT/CN2017/096413 priority Critical patent/WO2019028673A1/en
Publication of WO2019028673A1 publication Critical patent/WO2019028673A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a data communication system, method, web server, and monitoring system based on a B/S architecture.
  • wearable devices are becoming more and more popular, so remote control of wearable devices is particularly important.
  • the communication between the wearable device and the server or the communication between the remote monitoring platform and the server is based on the TCP (Transmission Control Protocol)-based C/
  • the S architecture (Client/Server structure, client and server structure) is implemented.
  • C/S architecture For the communication between the remote monitoring platform and the server, if it is implemented by C/S architecture, it is mostly applicable to the local area network. This method requires special technology for remote access, and the system is specially designed to handle distributed data. Relative to the rapid development of the Internet, there is a lack of certain scalability.
  • the C/S architecture can be seen as a "fat" client architecture, because the client needs to implement most of the business logic and interface presentation. In this architecture, the client needs to bear a lot of pressure, the user is When using, you need to install monitoring platform software to achieve communication between the two. There are also restrictions on the operating system of the client. In addition, every time the system is upgraded, all client programs need to be changed and upgraded.
  • a data communication system based on a B/S architecture comprising a client, a communication server, and a web server for connecting the client and the communication server, the web server having an intermediate communication component:
  • the browser of the client initiates an HTTP request to the intermediate communication component of the web server;
  • the intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
  • the intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
  • the communication server processes the Socket request and returns corresponding result data to display the result data through a browser of the client.
  • a data communication method based on a B/S architecture comprising:
  • the intermediate communication component of the web server obtains an HTTP request initiated by the client's browser
  • the intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
  • the intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
  • a web server for a data communication system based on a B/S architecture includes a client, a communication server, the web server is configured to connect the client and a communication server, and the web server is provided Intermediate communication component:
  • the intermediate communication component acquires an HTTP request initiated by a browser of the client
  • the intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server letter;
  • the intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
  • a wearable device-based monitoring system comprising a wearable device, and the above-described B/S architecture-based data communication system, the wearable device establishing a network data connection with the communication server, the client The end is used for remote monitoring of the wearable device:
  • the browser of the client initiates an HTTP request to the intermediate communication component of the web server when acquiring the operation of the user;
  • the intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
  • the intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
  • the communication server processes the Socket request, acquires result data corresponding to the wearable device according to the Socket request, and returns the result data to be displayed by a browser of the client.
  • the data communication system, method, web server and monitoring system based on the B/S architecture the browser of the client initiates an HTTP request to the intermediate communication component of the web server, and the intermediate communication component processes the HTTP request And establishing a socket communication with the communication server, the intermediate communication component transmitting a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol, the communication server processing the Socket request, and returning Corresponding result data, the result data is finally displayed by the browser of the client.
  • the client of the present application does not need to download the application and related operations, nor does it need to update frequently, which brings convenience to the user, reduces maintenance costs, and the like, and the user only needs to operate through the browser. Remote monitoring and operation of wearable devices.
  • FIG. 1 is a block diagram of a data communication system based on a B/S architecture in an embodiment
  • FIG. 2 is a flowchart of a data communication method based on a B/S architecture in an embodiment
  • FIG. 3 is a block diagram of a Web server of a data communication system based on a B/S architecture in an embodiment
  • FIG. 4 is a block diagram of an implementation example of a specific application example of a data communication system based on a B/S architecture
  • FIG. 5 is a flowchart showing an implementation of a communication server in the data communication system of FIG. 4;
  • FIG. 6 is a flowchart of an event processing of a new client initiating a TCP connection request in the data communication system of FIG. 4;
  • FIG. 7 is a flow chart of event processing of the intermediate communication component in the data communication system of FIG. 4;
  • FIG. 8 is a flow chart showing the processing mechanism of the communication between the client browser and the intermediate communication component in the data communication system of FIG. 4.
  • FIG. 1 is a block diagram of a data communication system based on a B/S architecture in an embodiment.
  • the data communication system based on the B/S architecture in this embodiment includes but is not limited to a client. 11.
  • the B/S architecture refers to a browser/server architecture
  • the web server refers to a web server
  • HTTP refers to a hypertext transfer protocol (HyperText Transfer Protocol).
  • the TCP/IP protocol refers to the Transmission Control Protocol/Internet Protocol
  • the Socket refers to the socket.
  • the browser of the client 11 initiates an HTTP request to the intermediate communication component 121 of the web server 12, and the intermediate communication component 121 processes the HTTP request and establishes with the communication server 13. Socket communication, the intermediate communication component 121 passes a Socket request corresponding to the HTTP request to the communication server 13 via a TCP/IP protocol, the communication server 13 processes the Socket request, and returns corresponding result data, To pass the guest The browser of the client 11 presents the result data.
  • the client 11 is a mobile terminal conveniently used by a user, and may specifically be a handheld mobile phone, a tablet computer or the like with a browser installed thereon.
  • the intermediate communication component 121 when receiving the HTTP request initiated by the browser, creates a socket and establishes a TCP/IP connection with the communication server 13, and if the connection fails, the connection fails. The information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server 13.
  • the intermediate communication component 121 in this embodiment can create a socket by using a socket creation function, for example, an existing socket creation function can be utilized:
  • the intermediate communication component 121 of this embodiment may send the Socket request to the communication server 13 through a socket write function, for example, socket_write ($socket, $message) may be utilized.
  • the intermediate communication component 121 sets a timeout period for the socket to wait for the first time, and receives the result data returned by the communication server 13 according to the Socket request, if the second time does not reach the first time If the result data returned by the communication server 13 is not received, the information of the failed data transmission is returned to the front page of the browser, and if the result data returned by the communication server 13 is received at the first time, the data is closed. Socket communication, whether the format of the detection result data is valid. If the format is incorrect, the information in response to the data exception is returned to the front page of the browser. If the format is correct, the returned result data is parsed and packaged into a predetermined one. The format data is sent to the front page of the browser.
  • the first time may be 10 seconds
  • the second time may be 5 seconds
  • the combination of the first time is 8 seconds and the second time is 4 seconds, which is not limited herein.
  • the predetermined format data may be json data (JavaScript Object Notation).
  • the data transmission format between the intermediate communication component 121 and the communication server 13 Need to be consistent, first, the client 11 needs to send a packet of the format "HEL; xxxxxxxxx; @" to the communication server 13 to mean that the client 11 goes online, and then sends a packet of the format "DATA; xxxxxxxxxxx; @" to the communication server 13 Used to transfer the data requested by the client 11.
  • both the wearer's wearable device and the web application of the front-end user act as a client for the communication server 13.
  • the client 11 and the wearable device are first required to go online. After the online connection is successful, the data is transmitted to the communication server 13 according to a predetermined data transmission format, and even after the transmission of the data is completed, the Socket communication is closed.
  • the intermediate communication component 121 can be implemented by the php language (Universal Open Source Scripting Language), which can run on an Apache (Web Server Software) server.
  • the communication server 13 in this embodiment may be based on the Epoll communication model and run on a Linux system.
  • the Epoll of this embodiment is an improved poll for the Linux kernel to process large batch file descriptors. In this way, the embodiment can significantly improve the system CPU utilization when the program has only a small amount of active in a large number of concurrent connections.
  • the communication server 13 initializes the Socket communication parameter, establishes the listening Socket descriptor, initializes the Epoll communication model, creates a linked list containing only the head node, initializes and starts the system timing of controlling the heartbeat packet, before processing the Socket request. , invokes the Epoll_wait function, and waits for the triggering of the client communication event in a blocking manner.
  • the Socket descriptor of the communication server 13 may use socket_fd, and the Epoll_wait function may use the Epoll_wait function.
  • the main program of the communication server 13 will exit the Epoll_waiting function, trigger the response to the client, and then, for example, can dynamically calculate the number of online clients.
  • the change in the number of online clients is mainly due to the occurrence and processing of communication events of the following clients, including but not limited to:
  • TCP Transmission Control Protocol
  • the Epoll_wait function of the communication server 13 finds that the communication event to be processed is equal to listening to the Socket descriptor, and is accepted according to the Socket descriptor.
  • the function returns a new Socket Descriptor, and the intercepted Socket Descriptor is added to the Epoll handle via the Epoll_Event Registration Function to communicate bi-directionally with the new client that has established a connection using the Socket Descriptor.
  • the acceptance function is an accept function
  • the event registration function is an Epoll_ctl function.
  • the webpage of the browser of the client 11 in this embodiment may adopt a JQuery (JavaScript code library, or JavaScript framework) framework, and communicate with the intermediate communication component 121 via AJAX (Asynchronous Javascript And XML).
  • the asynchronous JavaScript and XML) engine implements a communication connection to enable the web page to be asynchronously updated.
  • the AJAX engine can be used to create a fast dynamic webpage, and the webpage can be asynchronously updated by performing a small amount of data exchange with the server in the background.
  • the entire webpage can be reloaded without reloading the entire webpage.
  • the update of a certain part of the webpage does not cause the webpage to be stuck. This application can further improve the user experience in this way.
  • a communication event with the intermediate communication component 121 is triggered.
  • the browser of the client 11 implements and sets parameters of the request address, the request data, the request mode, and the timeout period by using the $.ajax() method, and when an HTTP request is initiated when the user's operation is obtained, if If the front-end webpage of the browser does not receive the return data within the timeout period, the current network abnormality is prompted. If the returned data is received within the timeout period, it is determined whether the data is a connection failure (connect_error), and if so, the server connection failure is prompted.
  • connect_error connection failure
  • the returned data is a data exception (data_error), and if so, it prompts a return data exception. If not, it determines whether the returned data is timeout (overtime), and if so, prompts to wait for the return data to time out, if not, then The obtained result data is parsed and displayed on the browser web page.
  • data_error data exception
  • timeout overtime
  • the client 11 of the present application does not need to download the application program and related operations, and does not need to update frequently, which brings convenience to the user and reduces maintenance cost.
  • the user only needs to operate through the browser to realize remote monitoring and operation. .
  • the client 11 for mobile phones, tablets, There is no need to download the application, and it is very space-saving, and it is not necessary to repeatedly update and download the latest client due to the update of the server, which brings great convenience to the client 11.
  • FIG. 2 is a flowchart of a data communication method based on the B/S architecture in an embodiment.
  • the data communication method based on the B/S architecture in this embodiment includes but is not limited to the following steps.
  • the intermediate communication component of the web server obtains an HTTP request initiated by the client's browser.
  • the intermediate communication component of the embodiment when receiving the HTTP request initiated by the browser, creates a socket and establishes a TCP/IP connection with the communication server, and if the connection fails, the connection fails.
  • the information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server.
  • the intermediate communication component of this embodiment may send the Socket request to the communication server through a socket write function, for example, socket_write ($socket, $message) may be utilized.
  • the intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server.
  • the intermediate communication component delivers a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol.
  • the intermediate communication component of the embodiment sets the timeout period for waiting for the Socket communication to be the first time, and receives the result data returned by the communication server according to the Socket request, if the first time is not reached. If the result data returned by the communication server is not received in the second time, the information of the failed data transmission is returned to the front page of the browser, and if the result returned by the communication server is received at the first time Data, close Socket communication, check whether the format of the result data is valid. If the format is incorrect, return the information in response to the data exception to the front page of the browser. If the format is correct, parse the returned result data, and The packaged into predetermined format data is sent to the front page of the browser.
  • the first time may be 10 seconds
  • the second time may be 5 seconds
  • the first time is 8 seconds
  • the second time is 4 seconds. set.
  • the predetermined format data may be json data.
  • FIG. 3 is a block diagram of a Web server of a data communication system based on a B/S architecture in an embodiment.
  • the Web server 12 of this embodiment is provided with an intermediate communication component 121, and the data communication system includes the above.
  • the client 11, the communication server 13, and the web server 12 are used to connect the client 11 and the communication server 13.
  • the intermediate communication component 121 acquires an HTTP request initiated by the browser of the client 11.
  • the intermediate communication component 121 processes the HTTP request and establishes a Socket communication with the communication server 13.
  • the intermediate communication component 121 delivers a Socket request corresponding to the HTTP request to the communication server 13 via a TCP/IP protocol.
  • the intermediate communication component 121 when receiving the HTTP request initiated by the browser, creates a socket and establishes a TCP/IP connection with the communication server 13, and if the connection fails, the connection fails. The information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server 13.
  • the intermediate communication component 121 of this embodiment may send the Socket request to the communication server 13 through a socket write function, for example, socket_write ($socket, $message) may be utilized.
  • the intermediate communication component 121 sets the timeout period for the socket to wait for the first time, and receives the result data returned by the communication server 13 according to the Socket request, if the second time does not reach the first time If the result data returned by the communication server 13 is not received, the information of the failed data transmission is returned to the front page of the browser, and if the result data returned by the communication server 13 is received at the first time, the data is closed. Socket communication, whether the format of the detection result data is valid, and if the format is incorrect, the information in response to the data abnormality is returned to the front page of the browser. If the format is correct, the returned result data is parsed and packaged into a predetermined format data and sent to the front page of the browser.
  • the first time may be 10 seconds
  • the second time may be 5 seconds
  • the combination of the first time is 8 seconds and the second time is 4 seconds, which is not limited herein.
  • the predetermined format data may be json data.
  • the overall communication process of the data communication system based on the B/S architecture of the present application may specifically send an HTTP request to the intermediate communication component 121 for the client 11 of the browser, and the intermediate communication component 121 sends a Socket request to the communication server 13
  • the communication server 13 then sends a Socket request to the wearable device, wherein the communication server 13 and the wearable device transmit through the socket.
  • the wearable device returns data to the communication server 13, to the intermediate communication component 121, and finally to the client 11 of the browser.
  • the intermediate communication component 121 of the present application forwards the data transmission to the Tcp protocol of the HTTP protocol, and the data transmission based on the Tcp protocol between the communication server 13 and the wearable device.
  • the intermediate communication component 121 is a server, ie, a B/S architectural mode, for the client 11 of the browser to receive the request of the client 11 of the browser.
  • the intermediate communication component 121, for the communication server 13, is a client, that is, a C/S architecture mode, and sends a request to the server (communication server 13).
  • the present application further provides a wearable device-based monitoring system, which includes a wearable device, and a data communication system based on the B/S architecture mentioned in any of the above embodiments, preferably, the embodiment Using the data communication system shown in FIG. 1, the wearable device establishes a network data connection with the communication server 13, and the client 11 is configured to remotely monitor the wearable device.
  • the browser of the client 11 initiates an HTTP request to the intermediate communication component 121 of the web server 12 when acquiring the user's operation.
  • the intermediate communication component 121 processes the HTTP request and establishes a Socket communication with the communication server 13.
  • the intermediate communication component 121 sets a Socket corresponding to the HTTP request through a TCP/IP protocol The request is passed to the communication server 13.
  • the communication server 13 processes the Socket request, acquires result data corresponding to the wearable device according to the Socket request, and returns the result data for display by the browser of the client 11.
  • the client 11 uses the client 11 to remotely monitor the wearable device, and the client 11 itself can be a mobile terminal conveniently used by the user, and the specific mobile phone and tablet can be handheld.
  • Computer of course, with the development of technology, it can also be a wearable device capable of intelligent display and operation, such as a smart watch, a smart helmet, smart glasses, etc.
  • this embodiment can use a mobile phone, a tablet computer or Wearable devices remotely monitor wearable devices.
  • FIG. 4 is a block diagram of an implementation example of a specific application example of a data communication system based on a B/S architecture
  • FIG. 5 is a flowchart of implementing a communication server in the data communication system of FIG.
  • FIG. 7 is a flow chart of event processing for initiating a TCP connection request in a data communication system of FIG. 4,
  • FIG. 7 is a flow chart of event processing of the intermediate communication component in the data communication system of FIG. 4,
  • FIG. 8 is a client in the data communication system of FIG.
  • the communication mechanism of the browser and the intermediate communication component processes the flow chart.
  • the implementation process of the communication server in the data communication system of the specific application example includes but is not limited to the following steps:
  • the server socket communication parameter is initialized, and the socket socket socket descriptor socket_fd is established;
  • the event processing procedure for a new client to initiate a TCP connection request in the data communication system of the specific application example includes but is not limited to the following steps:
  • the Epoll_wait function finds that the event to be processed is triggered to be equal to the listening socket descriptor socket_fd;
  • socket_fd Calling the accept function according to socket_fd returns a new socket socket descriptor socket_fd;
  • the event processing procedure of the intermediate communication component in the data communication system of the specific application example includes but is not limited to the following steps:
  • the processing mechanism of the communication mechanism between the client browser and the intermediate communication component in the data communication system of the specific application example includes but is not limited to the following steps:
  • the user is prompted to wait for the return data to time out and end, and if not, the returned data is presented to the browser page and ends.
  • the application client does not need to download the application and related operations, and does not need to update frequently, which brings convenience to the user, reduces maintenance costs, etc., and the user only needs to operate through the browser to implement the wearable device. Remote monitoring and operation.
  • the technical solution of the present application or the part that contributes to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions. All or part of the steps of the method of the various embodiments of the present application are performed by a computer device (which may be a personal computer, server, or network device, etc.) or a processor.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application relates to a B/S architecture-based data communication system and method, a web server, and a monitoring system. The data communication system comprises a client, a communication server, and a web server for connecting the client and the communication server. The web server is provided with an intermediate communication component. A browser of the client initiates an HTTP request to the intermediate communication component of the web server. The intermediate communication component processes the HTTP request and establishes a socket communication with the communication server. The intermediate communication component passes a socket request corresponding to the HTTP request to the communication server by means of a TCP/IP protocol. The communication server processes the socket request, and returns corresponding result data to display the result data via the browser of the client. In the above manner, a client in the present application does not need to download an application and perform related operations, and does not need to be updated frequently, bringing convenience to users and reducing maintenance costs.

Description

基于B/S架构的数据通信系统、方法、Web服务器及监控系统Data communication system, method, web server and monitoring system based on B/S architecture 技术领域Technical field
本申请涉及通信技术领域,特别是涉及一种基于B/S架构的数据通信系统、方法、Web服务器及监控系统。The present application relates to the field of communications technologies, and in particular, to a data communication system, method, web server, and monitoring system based on a B/S architecture.
背景技术Background technique
在物联网等通信领域,穿戴式设备越来越普及,那么对穿戴式设备远程控制就显得尤为重要。目前,在对穿戴式远程终端的操控上,不管是穿戴式设备与服务器之间的通信还是远程监控平台与服务器之间的通信均采用基于TCP协议(Transmission Control Protocol,传输控制协议)的C/S架构(Client/Server结构,客户机和服务器结构)来实现。In the field of communication such as the Internet of Things, wearable devices are becoming more and more popular, so remote control of wearable devices is particularly important. At present, in the manipulation of the wearable remote terminal, whether the communication between the wearable device and the server or the communication between the remote monitoring platform and the server is based on the TCP (Transmission Control Protocol)-based C/ The S architecture (Client/Server structure, client and server structure) is implemented.
对于远程监控平台与服务器的通信,若采用C/S架构实现,大多适用于局域网,这种方式远程访问需要专门的技术,同时要对系统进行专门的设计来处理分布式的数据,这种系统相对于互联网的飞速发展来说缺乏一定的扩展性。此外,C/S架构可以看作是“胖”客户端架构,因为客户端需要实现绝大多数的业务逻辑和界面展示,在这种架构中,作为客户端需要承受很大的压力,用户在使用时需要安装监控平台软件来实现两者之间的通信,对客户端的操作系统一般也会有限制,另外每次系统升级等,所有的客户端程序都需要改变、升级。For the communication between the remote monitoring platform and the server, if it is implemented by C/S architecture, it is mostly applicable to the local area network. This method requires special technology for remote access, and the system is specially designed to handle distributed data. Relative to the rapid development of the Internet, there is a lack of certain scalability. In addition, the C/S architecture can be seen as a "fat" client architecture, because the client needs to implement most of the business logic and interface presentation. In this architecture, the client needs to bear a lot of pressure, the user is When using, you need to install monitoring platform software to achieve communication between the two. There are also restrictions on the operating system of the client. In addition, every time the system is upgraded, all client programs need to be changed and upgraded.
不难看出,需要C/S架构会导致用户需要安装下载相应的客户端软件,来实现对穿戴式终端的远程控制,会需要耗费大量的流量和时间成本、而且给用户带来一定的个人信息泄漏风险;同时,客户端需要不定时更新升级,导致维护成本高,而且操作麻烦,不方便用户。It is not difficult to see that the need for C/S architecture will result in users needing to install and download the corresponding client software to achieve remote control of the wearable terminal, which will require a lot of traffic and time costs, and bring certain personal information to the user. The risk of leakage; at the same time, the client needs to update and upgrade from time to time, resulting in high maintenance costs, and the operation is troublesome and inconvenient for the user.
因此,本技术领域亟需提供一种新的数据通信系统,以解决上述技术问题。 Therefore, there is a need in the art to provide a new data communication system to solve the above technical problems.
发明内容Summary of the invention
基于此,有必要针对上述问题,提供一种基于B/S架构的数据通信系统、方法、Web服务器及监控系统,客户端不需要再下载应用程序及相关操作,也不需要频繁地进行更新,给用户带来方便,降低维护成本等。Based on this, it is necessary to provide a data communication system, method, web server and monitoring system based on the B/S architecture for the above problems, and the client does not need to download the application program and related operations, and does not need to update frequently. Bring convenience to users, reduce maintenance costs, etc.
一种基于B/S架构的数据通信系统,所述数据通信系统包括客户端、通信服务器以及用于连接所述客户端和通信服务器的Web服务器,所述Web服务器设有中间通信组件:A data communication system based on a B/S architecture, the data communication system comprising a client, a communication server, and a web server for connecting the client and the communication server, the web server having an intermediate communication component:
所述客户端的浏览器发起HTTP请求到所述Web服务器的所述中间通信组件;The browser of the client initiates an HTTP request to the intermediate communication component of the web server;
所述中间通信组件处理所述HTTP请求,并与所述通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器;The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
所述通信服务器处理所述Socket请求,并返回对应的结果数据,以通过所述客户端的浏览器展示所述结果数据。The communication server processes the Socket request and returns corresponding result data to display the result data through a browser of the client.
一种基于B/S架构的数据通信方法,所述数据通信方法包括:A data communication method based on a B/S architecture, the data communication method comprising:
Web服务器的中间通信组件获取客户端的浏览器发起的HTTP请求;The intermediate communication component of the web server obtains an HTTP request initiated by the client's browser;
所述中间通信组件处理所述HTTP请求,并与通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器。The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
一种用于基于B/S架构的数据通信系统的Web服务器,所述数据通信系统包括客户端、通信服务器,所述Web服务器用于连接所述客户端和通信服务器,所述Web服务器设有中间通信组件:A web server for a data communication system based on a B/S architecture, the data communication system includes a client, a communication server, the web server is configured to connect the client and a communication server, and the web server is provided Intermediate communication component:
所述中间通信组件获取所述客户端的浏览器发起的HTTP请求;The intermediate communication component acquires an HTTP request initiated by a browser of the client;
所述中间通信组件处理所述HTTP请求,并与通信服务器建立Socket通 信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server letter;
所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器。The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
一种基于穿戴式设备的监控系统,所述监控系统包括穿戴式设备,以及上述的基于B/S架构的数据通信系统,所述穿戴式设备与所述通信服务器建立网络数据连接,所述客户端用于对所述穿戴式设备进行远程监控:A wearable device-based monitoring system, the monitoring system comprising a wearable device, and the above-described B/S architecture-based data communication system, the wearable device establishing a network data connection with the communication server, the client The end is used for remote monitoring of the wearable device:
所述客户端的浏览器在获取到用户的操作时,发起HTTP请求到所述Web服务器的所述中间通信组件;The browser of the client initiates an HTTP request to the intermediate communication component of the web server when acquiring the operation of the user;
所述中间通信组件处理所述HTTP请求,并与所述通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器;The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
所述通信服务器处理所述Socket请求,根据所述Socket请求获取所述穿戴式设备对应的结果数据,并将所述结果数据返回以通过所述客户端的浏览器展示。The communication server processes the Socket request, acquires result data corresponding to the wearable device according to the Socket request, and returns the result data to be displayed by a browser of the client.
上述基于B/S架构的数据通信系统、方法、Web服务器及监控系统,所述客户端的浏览器发起HTTP请求到所述Web服务器的所述中间通信组件,所述中间通信组件处理所述HTTP请求,并与所述通信服务器建立Socket通信,所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器,所述通信服务器处理所述Socket请求,并返回对应的结果数据,最终通过所述客户端的浏览器展示所述结果数据。通过这种方式,本申请客户端不需要再下载应用程序及相关操作,也不需要频繁地进行更新,给用户带来方便,降低维护成本等,用户只需要通过浏览器就可以简单操作,实现对穿戴式设备的远程监控、操作。The data communication system, method, web server and monitoring system based on the B/S architecture, the browser of the client initiates an HTTP request to the intermediate communication component of the web server, and the intermediate communication component processes the HTTP request And establishing a socket communication with the communication server, the intermediate communication component transmitting a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol, the communication server processing the Socket request, and returning Corresponding result data, the result data is finally displayed by the browser of the client. In this way, the client of the present application does not need to download the application and related operations, nor does it need to update frequently, which brings convenience to the user, reduces maintenance costs, and the like, and the user only needs to operate through the browser. Remote monitoring and operation of wearable devices.
附图说明 DRAWINGS
图1为一实施例中基于B/S架构的数据通信系统的模块框图;1 is a block diagram of a data communication system based on a B/S architecture in an embodiment;
图2为一实施例中基于B/S架构的数据通信方法的流程图;2 is a flowchart of a data communication method based on a B/S architecture in an embodiment;
图3为一实施例中基于B/S架构的数据通信系统的Web服务器的模块框图;3 is a block diagram of a Web server of a data communication system based on a B/S architecture in an embodiment;
图4为本申请基于B/S架构的数据通信系统一具体应用例的实施框图;4 is a block diagram of an implementation example of a specific application example of a data communication system based on a B/S architecture;
图5为图4数据通信系统中通信服务器的实现流程图;5 is a flowchart showing an implementation of a communication server in the data communication system of FIG. 4;
图6为图4数据通信系统中新的客户端发起TCP连接请求的事件处理流程图;6 is a flowchart of an event processing of a new client initiating a TCP connection request in the data communication system of FIG. 4;
图7为图4数据通信系统中中间通信组件的事件处理流程图;7 is a flow chart of event processing of the intermediate communication component in the data communication system of FIG. 4;
图8为图4数据通信系统中客户端浏览器与中间通信组件的通信机制处理流程图。8 is a flow chart showing the processing mechanism of the communication between the client browser and the intermediate communication component in the data communication system of FIG. 4.
具体实施方式Detailed ways
在一个实施例中,请参阅图1,图1为一实施例中基于B/S架构的数据通信系统的模块框图,本实施例的基于B/S架构的数据通信系统包括但不限于客户端11、通信服务器13以及用于连接所述客户端11和通信服务器13的Web服务器12,所述Web服务器12设有中间通信组件121。In one embodiment, please refer to FIG. 1. FIG. 1 is a block diagram of a data communication system based on a B/S architecture in an embodiment. The data communication system based on the B/S architecture in this embodiment includes but is not limited to a client. 11. A communication server 13 and a web server 12 for connecting the client 11 and the communication server 13, the web server 12 being provided with an intermediate communication component 121.
需要说明的是,在本实施例中,所述B/S架构指的是浏览器/服务器架构,所述Web服务器指的是万维网服务器,HTTP指的是超文本传输协议(HyperText Transfer Protocol),TCP/IP协议指的是传输控制协议/因特网互联协议(Transmission Control Protocol/Internet Protocol),Socket指套接字。It should be noted that, in this embodiment, the B/S architecture refers to a browser/server architecture, the web server refers to a web server, and HTTP refers to a hypertext transfer protocol (HyperText Transfer Protocol). The TCP/IP protocol refers to the Transmission Control Protocol/Internet Protocol, and the Socket refers to the socket.
值得注意的是,所述客户端11的浏览器发起HTTP请求到所述Web服务器12的所述中间通信组件121,所述中间通信组件121处理所述HTTP请求,并与所述通信服务器13建立Socket通信,所述中间通信组件121通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器13,所述通信服务器13处理所述Socket请求,并返回对应的结果数据,以通过所述客 户端11的浏览器展示所述结果数据。It should be noted that the browser of the client 11 initiates an HTTP request to the intermediate communication component 121 of the web server 12, and the intermediate communication component 121 processes the HTTP request and establishes with the communication server 13. Socket communication, the intermediate communication component 121 passes a Socket request corresponding to the HTTP request to the communication server 13 via a TCP/IP protocol, the communication server 13 processes the Socket request, and returns corresponding result data, To pass the guest The browser of the client 11 presents the result data.
在优选的实施例中,所述客户端11为用户方便使用的移动终端,其具体可以为安装有浏览器的手持的手机、平板电脑等。In a preferred embodiment, the client 11 is a mobile terminal conveniently used by a user, and may specifically be a handheld mobile phone, a tablet computer or the like with a browser installed thereon.
需要指出的是,所述中间通信组件121在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器13建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请求发送到所述通信服务器13。It should be noted that, when receiving the HTTP request initiated by the browser, the intermediate communication component 121 creates a socket and establishes a TCP/IP connection with the communication server 13, and if the connection fails, the connection fails. The information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server 13.
值得一提的是,本实施例所述中间通信组件121可以利用套接字创建函数创建socket,譬如可以利用现有的套接字创建函数:It is worth mentioning that the intermediate communication component 121 in this embodiment can create a socket by using a socket creation function, for example, an existing socket creation function can be utilized:
$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)$socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)
此外,本实施例所述中间通信组件121可以通过套接字写函数将所述Socket请求发送到所述通信服务器13,譬如可以利用socket_write($socket,$message)。In addition, the intermediate communication component 121 of this embodiment may send the Socket request to the communication server 13 through a socket write function, for example, socket_write ($socket, $message) may be utilized.
其中,所述中间通信组件121设置socket等待的超时时间为第一时间,并接收所述通信服务器13根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器13返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器13返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页,若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。上述第一时间可以为10秒,第二时间可以为5秒;也可以为第一时间为8秒,第二时间为4秒的组合,在此不作限定。在具体实施例中,所述中间通信组件121可以通过套接字读函数接收所述通信服务器13根据所述Socket请求返回的结果数据,譬如可以通过$msg=socket_read($socket,1024)。其中,所述预定格式数据可以为json数据(JavaScript Object Notation,JS对象标记)。The intermediate communication component 121 sets a timeout period for the socket to wait for the first time, and receives the result data returned by the communication server 13 according to the Socket request, if the second time does not reach the first time If the result data returned by the communication server 13 is not received, the information of the failed data transmission is returned to the front page of the browser, and if the result data returned by the communication server 13 is received at the first time, the data is closed. Socket communication, whether the format of the detection result data is valid. If the format is incorrect, the information in response to the data exception is returned to the front page of the browser. If the format is correct, the returned result data is parsed and packaged into a predetermined one. The format data is sent to the front page of the browser. The first time may be 10 seconds, the second time may be 5 seconds, or the combination of the first time is 8 seconds and the second time is 4 seconds, which is not limited herein. In a specific embodiment, the intermediate communication component 121 can receive the result data returned by the communication server 13 according to the Socket request through a socket read function, for example, by using $msg=socket_read($socket, 1024). The predetermined format data may be json data (JavaScript Object Notation).
在本实施例中,中间通信组件121与通信服务器13之间的数据传输格式 需要一致,首先客户端11需要发送“HEL;xxxxxxxxxxx;@”格式的数据包到通信服务器13意味着客户端11的上线,然后再发送“DATA;xxxxxxxxxxx;@”格式的数据包到通信服务器13用来传输客户端11请求的数据。In the present embodiment, the data transmission format between the intermediate communication component 121 and the communication server 13 Need to be consistent, first, the client 11 needs to send a packet of the format "HEL; xxxxxxxxxxx; @" to the communication server 13 to mean that the client 11 goes online, and then sends a packet of the format "DATA; xxxxxxxxxxx; @" to the communication server 13 Used to transfer the data requested by the client 11.
总而言之,无论是携带者的穿戴式设备还是前端用户的网页应用,对于通信服务器13来说都充当着客户端的角色。在两者之间进行传输数据时首先需要客户端11和穿戴式设备上线,上线成功之后再向通信服务器13端按照预定的数据传输格式发送数据,在传输数据完成后即使关闭Socket通信。中间通信组件121可以由php语言(通用开源脚本语言)实现,其可以运行在Apache(Web服务器软件)服务器上。In summary, both the wearer's wearable device and the web application of the front-end user act as a client for the communication server 13. When transmitting data between the two, the client 11 and the wearable device are first required to go online. After the online connection is successful, the data is transmitted to the communication server 13 according to a predetermined data transmission format, and even after the transmission of the data is completed, the Socket communication is closed. The intermediate communication component 121 can be implemented by the php language (Universal Open Source Scripting Language), which can run on an Apache (Web Server Software) server.
进一步而言,本实施例所述通信服务器13可以为基于Epoll通信模型、并运行于Linux系统。其中,本实施例的Epoll是Linux内核处理大批量文件描述符作出改进的poll,通过这种方式,本实施例可以显著提高程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率。Further, the communication server 13 in this embodiment may be based on the Epoll communication model and run on a Linux system. The Epoll of this embodiment is an improved poll for the Linux kernel to process large batch file descriptors. In this way, the embodiment can significantly improve the system CPU utilization when the program has only a small amount of active in a large number of concurrent connections.
其中,所述通信服务器13在处理所述Socket请求之前,初始化Socket通信参数、建立监听Socket描述符、对Epoll通信模型初始化、创建只包含头结点的链表、初始化并启动控制心跳包的系统定时器、调用Epoll_等待函数,以及采用阻塞的方式等待所述客户端通信事件的触发。在本实施例中,所述通信服务器13的Socket描述符可以采用socket_fd,Epoll_等待函数可以采用Epoll_wait函数。The communication server 13 initializes the Socket communication parameter, establishes the listening Socket descriptor, initializes the Epoll communication model, creates a linked list containing only the head node, initializes and starts the system timing of controlling the heartbeat packet, before processing the Socket request. , invokes the Epoll_wait function, and waits for the triggering of the client communication event in a blocking manner. In this embodiment, the Socket descriptor of the communication server 13 may use socket_fd, and the Epoll_wait function may use the Epoll_wait function.
值得注意的是,通信事件的触发,需要满足以下事件之一,通信服务器13的主程序才会退出Epoll_等待函数,对客户端进行触发响应,接着比如可以动态的计算在线的客户端的数量,在线的客户端数量的变化,其主要归结为以下的客户端的通信事件的发生和处理,包括但不限于:It is worth noting that the triggering of the communication event needs to satisfy one of the following events, the main program of the communication server 13 will exit the Epoll_waiting function, trigger the response to the client, and then, for example, can dynamically calculate the number of online clients. The change in the number of online clients is mainly due to the occurrence and processing of communication events of the following clients, including but not limited to:
(1)新的客户端发起TCP(Transmission Control Protocol,传输控制协议)连接请求;(1) The new client initiates a TCP (Transmission Control Protocol) connection request;
(2)已经建立连接的客户端断开TCP连接的请求;(2) A request has been made to disconnect the TCP connection from the client that has established the connection;
(3)已经建立连接的客户端有数据(命令)传输; (3) The client that has established the connection has data (command) transmission;
(4)已经建立连接的客户端异常断开TCP连接;(4) The client that has established the connection abnormally disconnects the TCP connection;
需要说明的是,新的客户端发起TCP连接请求时,所述通信服务器13的所述Epoll_等待函数发现触发待处理的通信事件等于监听所述Socket描述符,根据所述Socket描述符调用接受函数返回新的Socket描述符,将侦听到的Socket描述符通过Epoll_事件注册函数添加到Epoll句柄中,以利用所述Socket描述符与已经建立连接的所述新的客户端进行双向通信。其中,所述接受函数为accept函数,所述事件注册函数为Epoll_ctl函数。It should be noted that when the new client initiates the TCP connection request, the Epoll_wait function of the communication server 13 finds that the communication event to be processed is equal to listening to the Socket descriptor, and is accepted according to the Socket descriptor. The function returns a new Socket Descriptor, and the intercepted Socket Descriptor is added to the Epoll handle via the Epoll_Event Registration Function to communicate bi-directionally with the new client that has established a connection using the Socket Descriptor. The acceptance function is an accept function, and the event registration function is an Epoll_ctl function.
值得一提的是,本实施例所述客户端11的浏览器的网页可以采用JQuery(JavaScript代码库,或JavaScript框架)框架,并与所述中间通信组件121之间通过AJAX(Asynchronous Javascript And XML,异步JavaScript和XML)引擎实现通信连接,以使所述网页实现异步更新。其中,本实施例AJAX引擎可以用于创建快速动态网页,通过在后台与服务器进行少量数据交换,可以使网页实现异步更新,换而言之,本实施例可以在不重新加载整个网页的情况下,对网页的某部分进行更新,不会造成网页卡顿的情况,本申请通过这种方式可以进一步提高用户体验。It should be noted that the webpage of the browser of the client 11 in this embodiment may adopt a JQuery (JavaScript code library, or JavaScript framework) framework, and communicate with the intermediate communication component 121 via AJAX (Asynchronous Javascript And XML). The asynchronous JavaScript and XML) engine implements a communication connection to enable the web page to be asynchronously updated. In this embodiment, the AJAX engine can be used to create a fast dynamic webpage, and the webpage can be asynchronously updated by performing a small amount of data exchange with the server in the background. In other words, in this embodiment, the entire webpage can be reloaded without reloading the entire webpage. The update of a certain part of the webpage does not cause the webpage to be stuck. This application can further improve the user experience in this way.
在本实施例中,用户点击浏览器的发送请求按钮等操作时,触发与中间通信组件121的通信事件。具体而言,所述客户端11的浏览器使用$.ajax()方法实现并设置请求地址、请求数据、请求方式和超时时间的参数,在获取到用户的操作而发起HTTP请求时,若在超时时间内所述浏览器的前端网页未收到返回数据,则提示当前网络异常,若在超时时间内接收到返回数据,则判断数据是否为连接失败(connect_error),若是,则提示服务器连接失败,若不是,接着判断返回数据是否为数据异常(data_error),若是,则提示返回数据异常,若不是,判断返回数据是否为超时(overtime),若是,则提示等待返回数据超时,若不是,则将获取到的结果数据经过解析展示到浏览器网页页面上。In the present embodiment, when the user clicks the browser's transmission request button or the like, a communication event with the intermediate communication component 121 is triggered. Specifically, the browser of the client 11 implements and sets parameters of the request address, the request data, the request mode, and the timeout period by using the $.ajax() method, and when an HTTP request is initiated when the user's operation is obtained, if If the front-end webpage of the browser does not receive the return data within the timeout period, the current network abnormality is prompted. If the returned data is received within the timeout period, it is determined whether the data is a connection failure (connect_error), and if so, the server connection failure is prompted. If not, then it is determined whether the returned data is a data exception (data_error), and if so, it prompts a return data exception. If not, it determines whether the returned data is timeout (overtime), and if so, prompts to wait for the return data to time out, if not, then The obtained result data is parsed and displayed on the browser web page.
本申请客户端11不需要再下载应用程序及相关操作,也不需要频繁地进行更新,给用户带来方便,降低维护成本等,用户只需要通过浏览器就可以简单操作,实现远程监控、操作。特别是针对客户端11为手机、平板电脑而言, 不再需要下载应用程序,而能够很好地节省空间、不需要由于服务器的更新而反复更新下载最新的客户端,给客户端11带来极大的便利性。The client 11 of the present application does not need to download the application program and related operations, and does not need to update frequently, which brings convenience to the user and reduces maintenance cost. The user only needs to operate through the browser to realize remote monitoring and operation. . Especially for the client 11 for mobile phones, tablets, There is no need to download the application, and it is very space-saving, and it is not necessary to repeatedly update and download the latest client due to the update of the server, which brings great convenience to the client 11.
请接着参阅图2,图2为一实施例中基于B/S架构的数据通信方法的流程图,本实施例基于B/S架构的数据通信方法包括但不限于如下几个步骤。Please refer to FIG. 2 . FIG. 2 is a flowchart of a data communication method based on the B/S architecture in an embodiment. The data communication method based on the B/S architecture in this embodiment includes but is not limited to the following steps.
S201,Web服务器的中间通信组件获取客户端的浏览器发起的HTTP请求。S201. The intermediate communication component of the web server obtains an HTTP request initiated by the client's browser.
在S201中,本实施例所述中间通信组件在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请求发送到所述通信服务器。In S201, when receiving the HTTP request initiated by the browser, the intermediate communication component of the embodiment creates a socket and establishes a TCP/IP connection with the communication server, and if the connection fails, the connection fails. The information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server.
本实施例所述中间通信组件可以利用套接字创建函数创建socket,譬如可以利用现有的$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)。此外,本实施例所述中间通信组件可以通过套接字写函数将所述Socket请求发送到所述通信服务器,譬如可以利用socket_write($socket,$message)。The intermediate communication component in this embodiment can create a socket by using a socket creation function, for example, the existing $socket=socket_create (AF_INET, SOCK_STREAM, SOL_TCP) can be utilized. In addition, the intermediate communication component of this embodiment may send the Socket request to the communication server through a socket write function, for example, socket_write ($socket, $message) may be utilized.
S202,所述中间通信组件处理所述HTTP请求,并与通信服务器建立Socket通信。S202. The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server.
S203,所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器。S203. The intermediate communication component delivers a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol.
在步骤S203之后,本实施例所述中间通信组件设置Socket通信等待的超时时间为第一时间,并接收所述通信服务器根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页,若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。上述第一时间可以为10秒,第二时间可以为5秒;也可以为第一时间为8秒,第二时间为4秒的组合,在此不作限 定。After the step S203, the intermediate communication component of the embodiment sets the timeout period for waiting for the Socket communication to be the first time, and receives the result data returned by the communication server according to the Socket request, if the first time is not reached. If the result data returned by the communication server is not received in the second time, the information of the failed data transmission is returned to the front page of the browser, and if the result returned by the communication server is received at the first time Data, close Socket communication, check whether the format of the result data is valid. If the format is incorrect, return the information in response to the data exception to the front page of the browser. If the format is correct, parse the returned result data, and The packaged into predetermined format data is sent to the front page of the browser. The first time may be 10 seconds, the second time may be 5 seconds, or the first time is 8 seconds, and the second time is 4 seconds. set.
所述中间通信组件可以通过套接字读函数接收所述通信服务器根据所述Socket请求返回的结果数据,譬如可以通过$msg=socket_read($socket,1024)。其中,所述预定格式数据可以为json数据。请接着参阅图3,图3为一实施例中基于B/S架构的数据通信系统的Web服务器的模块框图,本实施例的Web服务器12设有中间通信组件121,所述数据通信系统包括上述的客户端11、通信服务器13,所述Web服务器12用于连接所述客户端11和通信服务器13。The intermediate communication component may receive the result data returned by the communication server according to the Socket request through a socket read function, for example, by using $msg=socket_read($socket, 1024). The predetermined format data may be json data. Please refer to FIG. 3. FIG. 3 is a block diagram of a Web server of a data communication system based on a B/S architecture in an embodiment. The Web server 12 of this embodiment is provided with an intermediate communication component 121, and the data communication system includes the above. The client 11, the communication server 13, and the web server 12 are used to connect the client 11 and the communication server 13.
所述中间通信组件121获取所述客户端11的浏览器发起的HTTP请求。The intermediate communication component 121 acquires an HTTP request initiated by the browser of the client 11.
所述中间通信组件121处理所述HTTP请求,并与通信服务器13建立Socket通信。The intermediate communication component 121 processes the HTTP request and establishes a Socket communication with the communication server 13.
所述中间通信组件121通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器13。The intermediate communication component 121 delivers a Socket request corresponding to the HTTP request to the communication server 13 via a TCP/IP protocol.
需要说明的是,所述中间通信组件121在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器13建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请求发送到所述通信服务器13。It should be noted that, when receiving the HTTP request initiated by the browser, the intermediate communication component 121 creates a socket and establishes a TCP/IP connection with the communication server 13, and if the connection fails, the connection fails. The information is returned to the front end page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server 13.
本实施例所述中间通信组件121可以利用套接字创建函数创建socket,譬如可以利用现有的$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)。此外,本实施例所述中间通信组件121可以通过套接字写函数将所述Socket请求发送到所述通信服务器13,譬如可以利用socket_write($socket,$message)。The intermediate communication component 121 of this embodiment can create a socket by using a socket creation function, for example, the existing $socket=socket_create (AF_INET, SOCK_STREAM, SOL_TCP) can be utilized. In addition, the intermediate communication component 121 of this embodiment may send the Socket request to the communication server 13 through a socket write function, for example, socket_write ($socket, $message) may be utilized.
接着,所述中间通信组件121设置socket等待的超时时间为第一时间,并接收所述通信服务器13根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器13返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器13返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页, 若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。上述第一时间可以为10秒,第二时间可以为5秒;也可以为第一时间为8秒,第二时间为4秒的组合,在此不作限定。Next, the intermediate communication component 121 sets the timeout period for the socket to wait for the first time, and receives the result data returned by the communication server 13 according to the Socket request, if the second time does not reach the first time If the result data returned by the communication server 13 is not received, the information of the failed data transmission is returned to the front page of the browser, and if the result data returned by the communication server 13 is received at the first time, the data is closed. Socket communication, whether the format of the detection result data is valid, and if the format is incorrect, the information in response to the data abnormality is returned to the front page of the browser. If the format is correct, the returned result data is parsed and packaged into a predetermined format data and sent to the front page of the browser. The first time may be 10 seconds, the second time may be 5 seconds, or the combination of the first time is 8 seconds and the second time is 4 seconds, which is not limited herein.
如前所述,在本实施例所述中间通信组件121可以通过套接字读函数接收所述通信服务器13根据所述Socket请求返回的结果数据,譬如可以通过$msg=socket_read($socket,1024)。其中,所述预定格式数据可以为json数据。As described above, the intermediate communication component 121 in the embodiment can receive the result data returned by the communication server 13 according to the Socket request through a socket read function, for example, by using $msg=socket_read($socket,1024). ). The predetermined format data may be json data.
需要特别说明的是,本申请基于B/S架构的数据通信系统的总体通信过程具体可以为浏览器的客户端11发HTTP请求到中间通信组件121,中间通信组件121发送Socket请求到通信服务器13,通信服务器13再发送Socket请求到穿戴式设备,其中,通信服务器13与穿戴式设备之间是通过socket进行传输。穿戴式设备返回数据到通信服务器13,再到中间通信组件121,最终传输到浏览器的客户端11。本申请的中间通信组件121转发了HTTP协议的到Tcp协议的数据传输,而通信服务器13与穿戴式设备之间则是基于Tcp协议的数据传输。It should be particularly noted that the overall communication process of the data communication system based on the B/S architecture of the present application may specifically send an HTTP request to the intermediate communication component 121 for the client 11 of the browser, and the intermediate communication component 121 sends a Socket request to the communication server 13 The communication server 13 then sends a Socket request to the wearable device, wherein the communication server 13 and the wearable device transmit through the socket. The wearable device returns data to the communication server 13, to the intermediate communication component 121, and finally to the client 11 of the browser. The intermediate communication component 121 of the present application forwards the data transmission to the Tcp protocol of the HTTP protocol, and the data transmission based on the Tcp protocol between the communication server 13 and the wearable device.
中间通信组件121对于浏览器的客户端11来说,它是服务器,即B/S架构模式,以接收浏览器的客户端11的请求。而中间通信组件121对于通信服务器13来说,它是客户端,即C/S架构模式,向服务器(通信服务器13)发送请求。The intermediate communication component 121 is a server, ie, a B/S architectural mode, for the client 11 of the browser to receive the request of the client 11 of the browser. The intermediate communication component 121, for the communication server 13, is a client, that is, a C/S architecture mode, and sends a request to the server (communication server 13).
此外,本申请还提供一种基于穿戴式设备的监控系统,所述监控系统包括穿戴式设备,以及任一上述实施例提及的基于B/S架构的数据通信系统,优选地,本实施例采用图1所示的数据通信系统,所述穿戴式设备与所述通信服务器13建立网络数据连接,所述客户端11用于对所述穿戴式设备进行远程监控。In addition, the present application further provides a wearable device-based monitoring system, which includes a wearable device, and a data communication system based on the B/S architecture mentioned in any of the above embodiments, preferably, the embodiment Using the data communication system shown in FIG. 1, the wearable device establishes a network data connection with the communication server 13, and the client 11 is configured to remotely monitor the wearable device.
所述客户端11的浏览器在获取到用户的操作时,发起HTTP请求到所述Web服务器12的所述中间通信组件121。The browser of the client 11 initiates an HTTP request to the intermediate communication component 121 of the web server 12 when acquiring the user's operation.
所述中间通信组件121处理所述HTTP请求,并与所述通信服务器13建立Socket通信。The intermediate communication component 121 processes the HTTP request and establishes a Socket communication with the communication server 13.
所述中间通信组件121通过TCP/IP协议将与所述HTTP请求对应的Socket 请求传递到所述通信服务器13。The intermediate communication component 121 sets a Socket corresponding to the HTTP request through a TCP/IP protocol The request is passed to the communication server 13.
所述通信服务器13处理所述Socket请求,根据所述Socket请求获取所述穿戴式设备对应的结果数据,并将所述结果数据返回以通过所述客户端11的浏览器展示。The communication server 13 processes the Socket request, acquires result data corresponding to the wearable device according to the Socket request, and returns the result data for display by the browser of the client 11.
需要特别说明的是,本实施例使用所述客户端11对所述穿戴式设备进行远程监控,而所述客户端11自身则可以为用户方便使用的移动终端,其具体可以手持的手机、平板电脑,当然,随着技术的发展,其也可以为能智能显示和操作的穿戴式设备,比如智能手表、智能头盔、智能眼镜等,换而言之,本实施例可以使用手机、平板电脑或者穿戴式设备对穿戴式设备进行远程监控。请参阅图4-图8,其中,图4为本申请基于B/S架构的数据通信系统一具体应用例的实施框图,图5为图4数据通信系统中通信服务器的实现流程图,图6为图4数据通信系统中新的客户端发起TCP连接请求的事件处理流程图,图7为图4数据通信系统中中间通信组件的事件处理流程图,图8为图4数据通信系统中客户端浏览器与中间通信组件的通信机制处理流程图。It should be particularly noted that the client 11 uses the client 11 to remotely monitor the wearable device, and the client 11 itself can be a mobile terminal conveniently used by the user, and the specific mobile phone and tablet can be handheld. Computer, of course, with the development of technology, it can also be a wearable device capable of intelligent display and operation, such as a smart watch, a smart helmet, smart glasses, etc. In other words, this embodiment can use a mobile phone, a tablet computer or Wearable devices remotely monitor wearable devices. Referring to FIG. 4 and FIG. 8 , FIG. 4 is a block diagram of an implementation example of a specific application example of a data communication system based on a B/S architecture, and FIG. 5 is a flowchart of implementing a communication server in the data communication system of FIG. 4 . FIG. 7 is a flow chart of event processing for initiating a TCP connection request in a data communication system of FIG. 4, FIG. 7 is a flow chart of event processing of the intermediate communication component in the data communication system of FIG. 4, and FIG. 8 is a client in the data communication system of FIG. The communication mechanism of the browser and the intermediate communication component processes the flow chart.
如图5所示,本具体应用例数据通信系统中通信服务器的实现流程包括但不限于如下步骤:As shown in FIG. 5, the implementation process of the communication server in the data communication system of the specific application example includes but is not limited to the following steps:
服务器Socket通信参数初始化,建立监听socket套接字描述符socket_fd;The server socket communication parameter is initialized, and the socket socket socket descriptor socket_fd is established;
Epoll初始化;Epoll initialization;
动态链表的建立和初始化;The establishment and initialization of a dynamic linked list;
初始化并启动定时器中断;Initialize and start the timer interrupt;
调用epoll_wait函数,是否有客户端通信事件触发;若YES,则退出epoll_wait函数、遍历并处理通信事件,若NO,则阻塞,继续等待。Call the epoll_wait function to see if there is a client communication event trigger; if YES, exit the epoll_wait function, traverse and process the communication event. If NO, block and continue waiting.
如图6所示,本具体应用例数据通信系统中新的客户端发起TCP连接请求的事件处理流程包括但不限于如下步骤:As shown in FIG. 6, the event processing procedure for a new client to initiate a TCP connection request in the data communication system of the specific application example includes but is not limited to the following steps:
Epoll_wait函数发现触发待处理的事件刚好等于监听套接字描述符socket_fd;The Epoll_wait function finds that the event to be processed is triggered to be equal to the listening socket descriptor socket_fd;
根据socket_fd调用accept函数返回新的socket套接字描述符socket_fd; Calling the accept function according to socket_fd returns a new socket socket descriptor socket_fd;
将侦听到的新的套接字描述符socket_fd通过Epoll_ctl函数添加到Epoll句柄当中;Add the new socket descriptor socket_fd that is heard to the Epoll handle via the Epoll_ctl function;
返回。return.
如图7所示,本具体应用例数据通信系统中中间通信组件的事件处理流程包括但不限于如下几个步骤:As shown in FIG. 7, the event processing procedure of the intermediate communication component in the data communication system of the specific application example includes but is not limited to the following steps:
开始;Start;
接收到浏览器前端发来的HTTP请求;Received an HTTP request from the front end of the browser;
创建socket,socket_create();Create socket, socket_create();
建立TCP连接,socket_connect();Establish a TCP connection, socket_connect();
TCP连接是否建立成功?若否,则向浏览器前端返回connect_error并关闭Socket通信、结束;若是,则向通信服务器发送数据,socket_write();Is the TCP connection established successfully? If not, return connect_error to the browser front end and close the Socket communication, and end; if yes, send data to the communication server, socket_write();
设置超时时间,socket_set_option();Set the timeout period, socket_set_option();
等待通信服务器返回的数据;Waiting for data returned by the communication server;
等待是否超过5秒?若是,则向浏览器前端返回overtime,并关闭Socket通信、结束;若否,则获取通信服务器返回的数据;Is it waiting for more than 5 seconds? If yes, return overtime to the browser front end, and close the Socket communication and end; if not, obtain the data returned by the communication server;
数据是否有效?若否,则向浏览器前端返回data_error,并关闭Socket通信、结束;若是,则解析数据,并转换为json格式;Is the data valid? If not, return data_error to the browser front end, and close the Socket communication and end; if yes, parse the data and convert it to json format;
向浏览器前端返回json数据;Return json data to the browser front end;
关闭Socket通信、结束。Close Socket communication and end.
如图8所示,本具体应用例数据通信系统中客户端浏览器与中间通信组件的通信机制处理流程包括但不限于如下几个步骤:As shown in FIG. 8, the processing mechanism of the communication mechanism between the client browser and the intermediate communication component in the data communication system of the specific application example includes but is not limited to the following steps:
开始;Start;
点击发送请求按钮;Click the send request button;
触发通信事件;Trigger a communication event;
设置超时时间等参数;Set parameters such as timeout time;
等待时间是否小于10秒?若否,则提示用户网络异常并结束;若是,则接收到返回数据; Is the waiting time less than 10 seconds? If not, the user is prompted to be abnormal and ends; if so, the return data is received;
返回数据是否为connect_error?若是,则提示用户与服务器连接失败并结束;若否,则返回数据是否为data_error?Is the return data a connect_error? If yes, the user is prompted to connect to the server failed and ends; if not, is the data returned as data_error?
若是,则提示用户返回数据异常并结束,若否,则返回数据是否为overtime?If yes, the user is prompted to return a data exception and ends. If not, is the returned data overtime?
若是,则提示用户等待返回数据超时并结束,若否,则将返回数据呈现到浏览器的页面上并结束。If so, the user is prompted to wait for the return data to time out and end, and if not, the returned data is presented to the browser page and ends.
需要说明的是,本实施例的数据通信系统可以结合前面任一所述的实施例的相关描述,在本技术领域人员容易结合理解的范围内,不再赘述。It should be noted that the data communication system of this embodiment may be combined with the related description of any of the foregoing embodiments, and will not be further described in the scope of those skilled in the art.
本申请客户端不需要再下载应用程序及相关操作,也不需要频繁地进行更新,给用户带来方便,降低维护成本等,用户只需要通过浏览器就可以简单操作,实现对穿戴式设备的远程监控、操作。The application client does not need to download the application and related operations, and does not need to update frequently, which brings convenience to the user, reduces maintenance costs, etc., and the user only needs to operate through the browser to implement the wearable device. Remote monitoring and operation.
本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The technical solution of the present application or the part that contributes to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions. All or part of the steps of the method of the various embodiments of the present application are performed by a computer device (which may be a personal computer, server, or network device, etc.) or a processor. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述仅为本申请的实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。 The above description is only the embodiment of the present application, and thus does not limit the scope of the patent application, and the equivalent structure or equivalent process transformation made by using the specification and the drawings of the present application, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of this application.

Claims (14)

  1. 一种基于B/S架构的数据通信系统,其特征在于,所述数据通信系统包括客户端、通信服务器以及用于连接所述客户端和通信服务器的Web服务器,所述Web服务器设有中间通信组件:A data communication system based on a B/S architecture, characterized in that the data communication system comprises a client, a communication server, and a web server for connecting the client and the communication server, the web server is provided with an intermediate communication Component:
    所述客户端的浏览器发起HTTP请求到所述Web服务器的所述中间通信组件;The browser of the client initiates an HTTP request to the intermediate communication component of the web server;
    所述中间通信组件处理所述HTTP请求,并与所述通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
    所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器;The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
    所述通信服务器处理所述Socket请求,并返回对应的结果数据,以通过所述客户端的浏览器展示所述结果数据。The communication server processes the Socket request and returns corresponding result data to display the result data through a browser of the client.
  2. 根据权利要求1所述的数据通信系统,其特征在于,所述中间通信组件在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请求发送到所述通信服务器。The data communication system according to claim 1, wherein said intermediate communication component creates a socket upon establishment of said HTTP request initiated by said browser, and establishes a TCP/IP connection with said communication server If the connection fails, the information of the connection failure is returned to the front page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server.
  3. 根据权利要求2所述的数据通信系统,其特征在于,所述中间通信组件设置Socket通信等待的超时时间为第一时间,并接收所述通信服务器根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页,若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。The data communication system according to claim 2, wherein the intermediate communication component sets a timeout period for waiting for the Socket communication to be the first time, and receives result data returned by the communication server according to the Socket request, if If the result data returned by the communication server is not received within the second time period when the first time is not reached, the information that the data transmission failure is returned to the front page of the browser, if received at the first time The result data returned by the communication server is closed, and the format of the detection result data is valid. If the format is incorrect, the information of the response data abnormality is returned to the front page of the browser. If the format is correct, the format is returned. The resulting data is parsed and packaged into predetermined format data for transmission to the front end web page of the browser.
  4. 根据权利要求1-3任一项所述的数据通信系统,其特征在于,所述通 信服务器为基于Epoll通信模型、并运行于Linux系统,所述通信服务器在处理所述Socket请求之前,初始化Socket通信参数、建立监听Socket描述符、对Epoll通信模型初始化、创建只包含头结点的链表、初始化并启动控制心跳包的系统定时器、调用Epoll_等待函数,以及采用阻塞的方式等待所述客户端通信事件的触发。A data communication system according to any one of claims 1 to 3, wherein said communication The letter server is based on the Epoll communication model and runs on the Linux system. The communication server initializes the Socket communication parameters, establishes the listening Socket descriptor, initializes the Epoll communication model, and creates only the head node before processing the Socket request. Linking the list, initializing and starting the system timer that controls the heartbeat packet, calling the Epoll_waiting function, and waiting for the triggering of the client communication event in a blocking manner.
  5. 根据权利要求4所述的数据通信系统,其特征在于,新的客户端发起TCP连接请求时,所述通信服务器的所述Epoll_等待函数发现触发待处理的通信事件等于监听所述Socket描述符,根据所述Socket描述符调用接受函数返回新的Socket描述符,将侦听到的Socket描述符通过Epoll_事件注册函数添加到Epoll句柄中,以利用所述Socket描述符与已经建立连接的所述新的客户端进行双向通信。The data communication system according to claim 4, wherein when the new client initiates the TCP connection request, the Epoll_wait function of the communication server finds that the communication event to be processed is triggered to be equal to listening to the Socket descriptor. Retrieving a new Socket descriptor according to the Socket descriptor call accept function, and adding the intercepted Socket descriptor to the Epoll handle through the Epoll_ event registration function, to utilize the Socket descriptor and the established connection The new client performs two-way communication.
  6. 根据权利要求1-3任一项所述的数据通信系统,其特征在于,所述客户端的浏览器的网页采用JQuery框架,并与所述中间通信组件之间通过AJAX引擎实现通信连接,以使所述网页实现异步更新。The data communication system according to any one of claims 1 to 3, wherein the webpage of the browser of the client adopts a JQuery framework, and communicates with the intermediate communication component through an AJAX engine, so that The web page implements an asynchronous update.
  7. 根据权利要求6所述的数据通信系统,其特征在于,所述客户端的浏览器使用$.ajax()方法实现并设置请求地址、请求数据、请求方式和超时时间的参数,在获取到用户的操作而发起HTTP请求时,若在超时时间内所述浏览器的前端网页未收到返回数据,则提示当前网络异常,若在超时时间内接收到返回数据,则判断数据是否为连接失败,若是,则提示服务器连接失败,若不是,接着判断返回数据是否为数据异常,若是,则提示返回数据异常,若不是,判断返回数据是否为超时,若是,则提示等待返回数据超时,若不是,则将获取到的结果数据经过解析展示到浏览器网页页面上。The data communication system according to claim 6, wherein the browser of the client uses the $.ajax() method to implement and set parameters of the request address, the request data, the request mode, and the timeout period, and obtains the user's When an HTTP request is initiated, if the browser's front-end webpage does not receive the return data within the timeout period, the current network abnormality is prompted. If the returned data is received within the timeout period, it is determined whether the data is a connection failure, and if , the server connection failure is prompted, if not, then it is determined whether the returned data is a data exception, and if so, the data return is abnormal. If not, it is determined whether the returned data is a timeout, and if so, the data is timed out waiting for the return data, if not, then The obtained result data is parsed and displayed on the browser web page.
  8. 一种基于B/S架构的数据通信方法,其特征在于,所述数据通信方法包括:A data communication method based on a B/S architecture, characterized in that the data communication method comprises:
    Web服务器的中间通信组件获取客户端的浏览器发起的HTTP请求;The intermediate communication component of the web server obtains an HTTP request initiated by the client's browser;
    所述中间通信组件处理所述HTTP请求,并与通信服务器建立Socket通信; The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
    所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器。The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
  9. 根据权利要求8所述的数据通信方法,其特征在于,所述中间通信组件在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请求发送到所述通信服务器。The data communication method according to claim 8, wherein said intermediate communication component creates a socket upon establishment of said HTTP request initiated by said browser, and establishes a TCP/IP connection with said communication server If the connection fails, the information of the connection failure is returned to the front page of the browser, and if the connection is successful, the Socket request corresponding to the HTTP request is sent to the communication server.
  10. 根据权利要求9所述的数据通信方法,其特征在于,所述中间通信组件设置Socket通信等待的超时时间为第一时间,并接收所述通信服务器根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页,若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。The data communication method according to claim 9, wherein the intermediate communication component sets a timeout period for waiting for the Socket communication to be the first time, and receives result data returned by the communication server according to the Socket request, if If the result data returned by the communication server is not received within the second time period when the first time is not reached, the information that the data transmission failure is returned to the front page of the browser, if received at the first time The result data returned by the communication server is closed, and the format of the detection result data is valid. If the format is incorrect, the information of the response data abnormality is returned to the front page of the browser. If the format is correct, the format is returned. The resulting data is parsed and packaged into predetermined format data for transmission to the front end web page of the browser.
  11. 一种用于基于B/S架构的数据通信系统的Web服务器,其特征在于,所述数据通信系统包括客户端、通信服务器,所述Web服务器用于连接所述客户端和通信服务器,所述Web服务器设有中间通信组件:A web server for a data communication system based on a B/S architecture, characterized in that the data communication system includes a client, a communication server, and the web server is configured to connect the client and the communication server, The web server has an intermediate communication component:
    所述中间通信组件获取所述客户端的浏览器发起的HTTP请求;The intermediate communication component acquires an HTTP request initiated by a browser of the client;
    所述中间通信组件处理所述HTTP请求,并与通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
    所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器。The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server through a TCP/IP protocol.
  12. 根据权利要求11所述的Web服务器,其特征在于,所述中间通信组件在收到所述浏览器发起的所述HTTP请求时,创建一个socket,并与所述通信服务器建立TCP/IP连接,如果连接失败则将连接失败的信息返回到所述浏览器的前端页面,如果连接成功,则将所述HTTP请求对应的所述Socket请 求发送到所述通信服务器。The web server according to claim 11, wherein the intermediate communication component creates a socket and establishes a TCP/IP connection with the communication server upon receiving the HTTP request initiated by the browser. If the connection fails, the information of the connection failure is returned to the front page of the browser. If the connection is successful, the Socket corresponding to the HTTP request is requested. Request to send to the communication server.
  13. 根据权利要求12所述的Web服务器,其特征在于,所述中间通信组件设置Socket通信等待的超时时间为第一时间,并接收所述通信服务器根据所述Socket请求返回的结果数据,若在未到达所述第一时间的第二时间内未收到所述通信服务器返回的结果数据,则将发送数据失败的信息返回到所述浏览器的前端网页,若在所述第一时间收到所述通信服务器返回的结果数据,关闭Socket通信,检测结果数据的格式是否有效,若格式不正确,则将响应数据异常的信息返回到所述浏览器的前端网页,若格式正确,则对返回的结果数据进行解析,并打包成预定格式数据发送到所述浏览器的前端网页。The web server according to claim 12, wherein the intermediate communication component sets a timeout period for waiting for the Socket communication to be the first time, and receives result data returned by the communication server according to the Socket request, if not If the result data returned by the communication server is not received within the second time period of the first time, the information that the data failure is returned is returned to the front page of the browser, and if the first time is received, The result data returned by the communication server is closed, the Socket communication is closed, and the format of the detection result data is valid. If the format is incorrect, the information in response to the data abnormality is returned to the front page of the browser. If the format is correct, the returned data is returned. The resulting data is parsed and packaged into predetermined format data for transmission to the front end web page of the browser.
  14. 一种基于穿戴式设备的监控系统,其特征在于,所述监控系统包括穿戴式设备,以及根据权利要求1-7任一项所述的基于B/S架构的数据通信系统,所述穿戴式设备与所述通信服务器建立网络数据连接,所述客户端用于对所述穿戴式设备进行远程监控:A wearable device-based monitoring system, comprising: a wearable device, and a data communication system based on a B/S architecture according to any one of claims 1-7, the wearable The device establishes a network data connection with the communication server, and the client is configured to remotely monitor the wearable device:
    所述客户端的浏览器在获取到用户的操作时,发起HTTP请求到所述Web服务器的所述中间通信组件;The browser of the client initiates an HTTP request to the intermediate communication component of the web server when acquiring the operation of the user;
    所述中间通信组件处理所述HTTP请求,并与所述通信服务器建立Socket通信;The intermediate communication component processes the HTTP request and establishes a Socket communication with the communication server;
    所述中间通信组件通过TCP/IP协议将与所述HTTP请求对应的Socket请求传递到所述通信服务器;The intermediate communication component transmits a Socket request corresponding to the HTTP request to the communication server by using a TCP/IP protocol;
    所述通信服务器处理所述Socket请求,根据所述Socket请求获取所述穿戴式设备对应的结果数据,并将所述结果数据返回以通过所述客户端的浏览器展示。 The communication server processes the Socket request, acquires result data corresponding to the wearable device according to the Socket request, and returns the result data to be displayed by a browser of the client.
PCT/CN2017/096413 2017-08-08 2017-08-08 B/s architecture-based data communication system and method, web server, and monitoring system WO2019028673A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/096413 WO2019028673A1 (en) 2017-08-08 2017-08-08 B/s architecture-based data communication system and method, web server, and monitoring system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/096413 WO2019028673A1 (en) 2017-08-08 2017-08-08 B/s architecture-based data communication system and method, web server, and monitoring system

Publications (1)

Publication Number Publication Date
WO2019028673A1 true WO2019028673A1 (en) 2019-02-14

Family

ID=65272753

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/096413 WO2019028673A1 (en) 2017-08-08 2017-08-08 B/s architecture-based data communication system and method, web server, and monitoring system

Country Status (1)

Country Link
WO (1) WO2019028673A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110445642A (en) * 2019-07-17 2019-11-12 陕西千山航空电子有限责任公司 A kind of means of communication of across bus maintenance FDR system
CN110557380A (en) * 2019-08-07 2019-12-10 北京首贝科技发展有限公司 secure data transmission method based on TCP/IP protocol
CN112422681A (en) * 2020-11-18 2021-02-26 中盈优创资讯科技有限公司 Cross-platform distributed communication calling method and device
CN113064158A (en) * 2021-03-17 2021-07-02 中国有色金属长沙勘察设计研究院有限公司 Engineering disaster intelligent monitoring radar communication system based on double middleware
CN113542408A (en) * 2021-07-14 2021-10-22 首约科技(北京)有限公司 Method for interaction of message between driver and passenger
CN113626208A (en) * 2020-05-08 2021-11-09 许继集团有限公司 Server communication method based on NIO asynchronous thread model
CN114827114A (en) * 2022-04-22 2022-07-29 雷沃工程机械集团有限公司 Method and system for realizing data twinning of engineering machinery Internet of vehicles platform
CN115118704A (en) * 2022-05-18 2022-09-27 青岛国实科技集团有限公司 Method for realizing function linkage of same platform heterogeneous system in marine application

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043522A (en) * 2006-03-22 2007-09-26 腾讯科技(深圳)有限公司 Web server based communication method and system
CN102835093A (en) * 2010-04-15 2012-12-19 微软公司 Method and system for reliable protocol tunneling over http
US20130212227A1 (en) * 2012-02-09 2013-08-15 Cogent Real-Time Systems Inc. System and method for streaming data via http
CN103297384A (en) * 2012-02-22 2013-09-11 航天信息股份有限公司 Method and system for communication of protocol conversion

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043522A (en) * 2006-03-22 2007-09-26 腾讯科技(深圳)有限公司 Web server based communication method and system
CN102835093A (en) * 2010-04-15 2012-12-19 微软公司 Method and system for reliable protocol tunneling over http
US20130212227A1 (en) * 2012-02-09 2013-08-15 Cogent Real-Time Systems Inc. System and method for streaming data via http
CN103297384A (en) * 2012-02-22 2013-09-11 航天信息股份有限公司 Method and system for communication of protocol conversion

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110445642A (en) * 2019-07-17 2019-11-12 陕西千山航空电子有限责任公司 A kind of means of communication of across bus maintenance FDR system
CN110557380A (en) * 2019-08-07 2019-12-10 北京首贝科技发展有限公司 secure data transmission method based on TCP/IP protocol
CN113626208A (en) * 2020-05-08 2021-11-09 许继集团有限公司 Server communication method based on NIO asynchronous thread model
CN113626208B (en) * 2020-05-08 2024-05-14 许继集团有限公司 Server communication method based on NIO asynchronous thread model
CN112422681A (en) * 2020-11-18 2021-02-26 中盈优创资讯科技有限公司 Cross-platform distributed communication calling method and device
CN112422681B (en) * 2020-11-18 2023-01-13 中盈优创资讯科技有限公司 Cross-platform distributed communication calling method and device
CN113064158A (en) * 2021-03-17 2021-07-02 中国有色金属长沙勘察设计研究院有限公司 Engineering disaster intelligent monitoring radar communication system based on double middleware
CN113542408A (en) * 2021-07-14 2021-10-22 首约科技(北京)有限公司 Method for interaction of message between driver and passenger
CN113542408B (en) * 2021-07-14 2024-04-19 首约科技(北京)有限公司 Method for interaction message between driver and passenger
CN114827114A (en) * 2022-04-22 2022-07-29 雷沃工程机械集团有限公司 Method and system for realizing data twinning of engineering machinery Internet of vehicles platform
CN115118704A (en) * 2022-05-18 2022-09-27 青岛国实科技集团有限公司 Method for realizing function linkage of same platform heterogeneous system in marine application

Similar Documents

Publication Publication Date Title
WO2019028673A1 (en) B/s architecture-based data communication system and method, web server, and monitoring system
US10686775B2 (en) Method and apparatus of providing messaging service and callback feature to mobile stations
CN107426233A (en) Data communication system, method, Web server and monitoring system based on B/S frameworks
US9223746B2 (en) Data card and method for internet access of data card
US9491682B2 (en) Wireless routing device, mobile terminal, and management system and method
US11025724B2 (en) Transport of control data in proxy-based network communications
US9124494B2 (en) Method and apparatus of performing remote management of a managed machine
US10594768B2 (en) Method and apparatus of performing remote command dispatching
WO2016058133A1 (en) Software upgrading method and device
US10574518B2 (en) Method and apparatus of performing remote management of a managed machine
WO2017045190A1 (en) Method, apparatus and device for instructing operations on terminal device
EP3435629A1 (en) Transport of control data in proxy-based network communications
CN115866069A (en) Method and system for processing remote call request and electronic equipment
CN115904081A (en) Human-computer interaction method and device based on Internet of things and related medium

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: 17920941

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: 17920941

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.04.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17920941

Country of ref document: EP

Kind code of ref document: A1