一种基于TCPIP协议的有效远程控制系统_第1页
一种基于TCPIP协议的有效远程控制系统_第2页
一种基于TCPIP协议的有效远程控制系统_第3页
一种基于TCPIP协议的有效远程控制系统_第4页
一种基于TCPIP协议的有效远程控制系统_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、2008 international conference on advanced computer theory and engineering 2008年高级计算机理论少控制工程国际会议an effective remote control system based on tcp/ip一种基于tcp /ip协议的有效远程控制系统十木工程学院青岛理工大学中国青岛26603gengxyxueyu gengschool of civil engineeringqingdao technological university qingdao, 266033, chinagengxy gmai 1

2、.com计算机工程学院 青岛理丄大学 中国青岛266033 wangjinlongshunyao wu, jinlong wangt, and peng li school of computer engineering qingdao technological university qingdao, 266033, china wangjinlonggmailcomwith the network technology development, remote technology is gradually occupying the technology mainstream. it ha

3、s become more and more popular in the home office and distance education. the rapid development provides a broad world to the remote control software. pcanywheredamewhere, qq remote assistance, and other remote control software have emerged in remote control, improving efficiency and ensuring accura

4、cy of the transmission are paramount to evaluate the success of a remote control software.this paper has developed a remote control system,and focuses on intercepting the control and the images, and tcp-stick packages- solving these problems well is useful to improve the efficiency of the system and

5、 ease the pressure on network. finally, through analysis and experiments, methods are proved to be effective.随著网络技术的发展,远程技术逐渐占据了技术的主流。刈在家里办公和远程教育的人來说, 它已经变得越来越受欢迎。它的快速发展为远程控制软件提供了广阔的天地。pcanywhere, damewhere, qq远程协助及其他远程控制软件已经出现,在远程控制领域,提高效率和确 保准确的传输对评价一个远程控制软件的成功与否是极为重要的。木文描述了一种远程控制 系统,并侧重于拦截控制、图像及t

6、cp粘包。有效的解决这些问题,有利于提高系统的效 率和缓解网络的压力。最后,通过分析和试验,方法被证明是有效的。1. introduction1.引言the rapid development of network technology, home office and distance education provides a broad world to the remote control software. as early as 199& idc expected the remote control software market would be the third fa

7、stest growing area in the consumer market which was supported by the software technology 1.随着网络技术的飞速发展,家庭办公和远程教育为远程控制软件提供了广阔的天地。早在 1998年,idc就预测远程控制软件的市场将是第三个由软件技术支持的消费市场里增长最 快的领域。remote control 1, 2, 3, 4 is a technology that administrators connect the target computer through the network by remote d

8、ialing or the way that both dial into internet, then manage and maintain the remote computers by local host 1. the remote control software is based on the client/server model oriented towards connection agreement( tcp/ip). it includes a server program installed on the client, and a client program on

9、 the host. the general operating principle of remote control is shown in figure 1.远程控制是一种管理员通过远程拨号上网或双方拨号接入internet的方式连接目标计算机, 然后通过本地主机管理和维护远程计算机的技术。远程控制软件是基于客户机/服务器模式 面向连接协议(tcp/ip)。它包括安装在客户端上的服务器程序和在主机上的客户端程序。 远程控制的基本工作原理见图lofigure 1. one-to-one network topology remote control. 图1 一对一远程控制网络拓扑图firs

10、t of all the client should set twokinds of authorities ofswords, and tell the ipaddress and password to the host.after building the connection, the host should set the image quality and fps (frames per second). then, the client captures the screen, compresses the images and sends the images to the h

11、ost. after receiving the screen images, the host can watch the screen of the client. finally, the host can control the client. when the host operates on the graphical interface, the mouse action and the keyboard input should be packaged to the client. the client operates the information, and sends t

12、he screen images to the host, and so on.首先,客八应设證两种类型的密码权限,告诉主机ip地址和密码。建立连接后,主机应设 置图像质量和fps (帧每秒),然后,客户端捕获屏幕,压缩图像并将图像传送到主机。收 到屏幕图像示,丄机可以查看客户端的屏幕。最示,主机可以控制客户端。当主机在图形界 面上进行操作,鼠标的操作和键盘的输入被打包到客户端。客户端运行这些信息,并将屏幕 图像等发送到主机。according to the basic process of the remote control as shown in figure 1, the paper

13、developed a remote control software, focused on intercepting the control and the images, and tcp-stick packages. solving these problems well is useful to improve the efficiency of the system and ease the pressure on network. finally, with analysis and experiments, methods are proved to be effective.

14、依据如图1所示的远冠控制的基本过帝,本论文描述了一个远程控制软件,侧重于拦截控制、 图像及tcp粘包。有效的解决这些问题,有利于提高系统的效率和缓解网络的压力。 最后,通过分析和试验,方法被证明是冇效的。the rest of the paper is organized as follows. section 2 introduces the overview framework of remote control system and the function of each subsystem. the detailed method to solve the control inter

15、ception will be introduced in section 3, and the method to solve the image capture and the image display is described in section 4, and the solution of the tcp-stick packages in section 5. the experimental analysis is described in section 6. the paper is concluded in the last section.本文的其余部分貝-体如下。笫2

16、部分介绍远程控制系统的框架概述和各子系统的功能。笫3 部分介绍控制拦截的详细的解决方法,笫4部分介绍图像采集和图像显示的解决方法,笫5 部分介绍tcp粘包解决方案,第6部分屮介绍实验分析,论文最示部分得出结论。2. overview framework2.框架概述figure 2. the relations among the six subsystems.图2六个子系统之间的关系the paper divided remote control system into six subsystems, authority subsystem, communications subsystem,

17、captured images subsystem, images display subsystem, intercepted control subsystem, and simulation control subsystem.figure 2 is a brief diagram of the relations among the six subsystems.木文将远程控制系统分为六个子系统,权限了系统、通信了系统、捕捉图像了系统、图像显 示子系统、截获控制子系统及仿真控制子系统。图2是六个子系统关系的简要图。the functions of the six subsystems

18、are as follows: 六个子系统的功能如f:1. authority subsystem manages the user authority. the client can set two kinds of passwords, one only to watch and the other to control. two kinds of passwords are stored in the document after encrypted. the host inputs the respective password to get the appropriate autho

19、rity.1. 权限子系统管理用户的权限。客户端可以设宜两种密码权限,一种只浏览,另一种可控 制。两种类型的密码都存储在加密后的文件里。主机输入相应的密码以获得相应的权限。2. communications subsystem is primarily responsible for communications between the host and the client.the subsystem is divided into host and client module. host module is mainly responsible for transmitting the i

20、mage information to the client, while client module is mainly responsible for transmitting the mouse action and the keyboard input to the host.2. 通信了系统主要负気主机和客户端的沟通。该了系统分为主机和客户端模块。主机模块 主要负责向客八端传输图像信息,而客户端模块主要负责向主机传递鼠标操作和键盘输入命 令。3. intercepted control subsystem intercepts the mouse action and the key

21、board of the host, and gives these information to host module of communications subsystem after packaging them. then, host module transmit these information to the client.3. 截获控制子系统截取主机的鼠标操作和键盘输入,打包后向通信子系统的主机模块给出 了这些信,社,然后,主机模块发送这些信息给客户端。4. simulation control subsystem obtains the mouse action and t

22、he keyboard input from client module of communications subsystem4. 仿真軽制了系统获得來自通信了系统客户端模块的鼠标操作和键盘输入。5. captured images subsystem calls the function to capture screen in the client, and stores the images formatted in bmp in memory, and converts bmp images to jpeg images, in order to facilitate the rap

23、id transmission on the network5. 捕捉图像子系统在客户端调用函数捕获屏幕,将图像以bmp格式存储在内存中,并且为 了便于在网络上迅速传播,将bmp图像转换为jpeg图像。6. images display subsystem reverts the data received from communications subsystem to jpeg images, and converts them to bmp images, and displays these images on the screen in the host.6. 图像显示子系统将来白通

24、信子系统的数据还原为jpeg格式图像,并将其转换为bmp格 式图像,在主机屛幕上显示这些图像。3> intercepted control subsystem3. 截获控卿子系统generally speaking, intercepted control subsystem is mainly responsible for the interception of the mouse action and keyboard input. the intercepted accuracy will directly affect the accuracy of simulation co

25、ntrol subsystem. for example, users move the mouse to the location of a folders over the graphical interface, while the coordinates of the mouse is (0,0). then double click operates it, but coordinates of the mouse which is got by intercepted control subsystem is (1,0). this may result in errors tha

26、t the client can not correctly implement, and is unable to open the selected folder. in addition, when the subsystem intercepts information, it should be payed a lot attentions on the validity.we can avoid intercepting unnecessary information to improve the efficiency. when authentication successes

27、and user operate the host, intercepted control subsystem should take different measures by user authority. if the authority is to control, it will intercept the mouse action and keyboard input; if not, it will not. once intercepted control subsystem intercept the mouse action and keyboard input, the

28、 problem of the interception field should be put first. when user operates the host, it will never be always intercepted. some other things may be solved. if intercepted control subsystem do not fix the interception field, some useless information will be intercepted. this will result in some very d

29、ifficult problems that simulation control subsystem is difficult to design and implement. in addition, it will reduce the efficiency.一般来说,截获控制了系统主要负责鼠标操作和键盘输入的拦截。被拦截的精度将肓接影响 仿真控制子系统的精度。例如,用户移动鼠标到一个文件夹的图形界而位査,鼠标的处标是(0,0),然后双击运行它,但截取图像子系统上的鼠标的处标变为(1,0)。这nj能因为错误 导致客户端不能止确执行,并冃无法打开选定的文件夹。此外,当了系统截取信息时,应当

30、 多关注有效性。我们可以避免不必耍的信息拦截进而捉高效率。当身份验证成功,川户操作 主机时,截获控制子系统应当通过用八权限采取不同的措施应对。如果权限是控制,它会拦 截鼠标操作和键盘输入,反z,则不会。一旦截获控制子系统拦截鼠标操作和键盘输入,截 取领域出现的问题应放在一位。当用户操作主机,它将永远不会被截获。一些其他的事情可 能得到解决。如果拦截控制子系统不能控制拦截领域,一些无用的信息将被拦截。这将导致 出现一些非常棘手的问题,仿真控制子系统将很难设计和实施。此外,它会降低工作效率。 in order to solve the problem about the interception

31、field, the paper tried several measures:为t解决拦截领域出现的问题,本文尝试了几种措施:1. with hook to achieve the interception of mouse actionand keyboard input. the basis for determining the interception field, two points must be met at the same time. 墾标操作和键盘输入世燮i畦塑匡翌截领域的基础是,以下两点必须同时满足。 intercepting only if the system w

32、indow is active; if the system window is active, the position of the mouse should be in the working仅在系统的窗口处于活动状态时拦截如果系统窗口处于活动状态,鼠标的位置应在工作区table 4. comparisons among three plexitydiflicultvefliciencv<<method 1hardermore diflicultlowermethod 2easiermore diilicultlowermethod 3easierhig

33、her表13种方法的比较复朵性困难性效率方法1困难更难低方法2容易更难低方法3容易-髙2. with the functions such as pretranslatemessag, windowsproc and so on to intercept. although implementing these functions is easier than hook, the intercepted information is almost all the windows messages. thus choosing this method should do the same wor

34、k as the above one 2. 如拦截pretranslatemessag, windowsproc的功能等。虽然实施这些功能比挂钩容易,被 拦截的几乎所有都是windows信息。因此,选择此芳法应做上述同样的工作之一。3. overloading the mouse message function of cview class; while the keyboard input is also intercepted by the function pretranslatemessag. the mouse message functions are the member fu

35、nctions of cview class.only if the mouse move in the working area, interception is doing. in this way,there is no need to determine whether the mouse is in the working area. the method saves time and space, and improves efficiency.3. 重载cview类的鼠标消息功能,而键盘输入也是由函数pretranslatemessag截获。鼠标消息 函数是cview类的成员函数

36、。只有当鼠标在工作区移动,拦截才是有效的。用这种方法,没 有必耍再确定鼠标是否在工作区。该方法节省了时间和皐间,捉西了效餐table 1 analyzes and compares three methods from the complexity, the difficulty to intercept field and efficiency.as a result, this paper selected the third method. the method is easy to implement, does not determine the interception field

37、 and has a higher efficiency.表1分析和比较三种方法的复杂性,拦截领域的难易度和效率。因此 本文选择了第三种方 法。该方法容易实现,不决定拦截领域,具有更高的效率。4. capture and display images4. 捕捉和显示图像in the development of captured images subsystem and images display subsystem, we should put the use of bandwidth first. as remote control system is mainly used for l

38、an transmission 1. the transmission speed in local area network is usually 10 mbps to 100mbps. therefore, the transmission bandwidth should reach 10mbps. the client should set the image quality and the transmission speed on the basis of network bandwidth. the captured images are stored in bmp format

39、. each 1024*768 bmp with 24bit color graphics needs more than 2mb space. even if the transmission fps is 1 fps, the bandwidth needs reach at least 16 mbps, far more than 10 mbps. so the images must be compressed before transmission.随着捕获图像孕系统和图像也示孕系统的发展,我们应该把它首先应用丁宽带。远程控制系 统主要用于局域网的传输1。在局域网的传输速度一般为10

40、 mbps到100mbps的。因此,要 达到10mbps的传输带宽。客户应在网络宽带的基础上设登图像质量和传输速度。截获的图 像存储为bmp格式。每个24彩色的1024*768的bmp图像需要超过2mb的空间。即使是一帧 帧传输,需要的带宽至少达到16 mbps,远远超过10 mbps。因此,图像必须压缩后传输。after capturing the images, the system will store them in a certain format, such as bmp, jpeg. the two methods are different. although using bm

41、p is easy, data traffic need a harsh bandwidth, and scalability is not strong. it is not conductive to operate in the future. however, jpeg compression is convenient, with large compression ratio and small distortion. therefore, the paper made use of cximage class library to compress jpeg.拍摄的照片后,系统会

42、存储在一个特定格式,如bmp, jpeg格式。这两种格式是不同的。虽 然bmp使用容易,但盂要一个较大的数据流量的带宽,可扩展性不强。这在未来不利于经营。 然而,jpeg压缩方便,拥有人压缩比和失真小的特点。因此,木文使用cximage类库压缩 jpeg图像。after captured images subsystem does the screen-shot, it will pass the image formatted in memory block to the cx-image category formatted. cxlmage class can immediately c

43、onvert the memory blocks to jpeg image. with cxlmage class, system will do a jpeg compression operation. the process sets the compression quality, from 0 to 100 (the numerical representation for image quality). after compression, communications subsystem will send them to the host.通过截获图像子系统截图后,它会通过在

44、内存块格式化为cxlmage的图像类型。cxlmage可 以立即将内存块转换为jpeg图像。系统用cxlmage做-个jpeg压缩操作。该程序压缩质最 从0到100 (图像质量数值表示)。压缩后,通信子系统将它们发送到主机。secondly, we should solve how to make users convenient to set image quality, transmission speed and so on. if we compress the images in a fixed proportion following the same pattern, and d

45、o not consider the state of users' network, it may happen that users who,s bandwidth is low feel the screen is not coherent, while users who's bandwidth is high feel image quality is not good. therefore, in the actual use process, users should be able to adjust the image compression level ac

46、cording to the current state of the network.其次,我们要解决如何使用户方便地设置图像质虽:、传输速度等问题。如果我们压缩在一个 固定比例的图像t篇一律,不考虑用户的网络状态,冇可能发生冇些川户带宽感觉画面不连 贯,有些川户感觉宽带感觉图像质量不好。因此,在实际使用过程屮,川户应该能够根据网 络岂网状态调整图像的压缩级别。thirdly, we should consider the transmission number per second. on the basis of different purposes, different realtim

47、e levels is need so, it need users to set the image fps. when a user requests high realtime level, the image fps should be improved then, the change of the image will be faster, and the user needs will be met.第三,我们在不同用途不同实时级别的基础上m该考虑每秒传输次数是很必要的。因此,用 户需要设査图像帧。当用户要求高的水平,图像的fps应该加以改进。这样,图像的变化会 咨快,用户需求将

48、得到满足。in the middle level compression, a 1024*768 jpeg image whc/s plans are 32 color need only 80 kb. in the 4/s fps, occupied bandwidth is about 2.5 mbps. it is good to adapt to the local area network bandwidth requirements, and image quality and fluency can meet users9 requirements.中间级别压缩的时候,计划是32

49、色彩的1024 * 768的jpeg图像只需要80 kb。4/s帧时, 占用带宽大约是2.5 mbpso这能很好的适应木地区域网络带宽的要求,满足用户图像质量 和流畅度的要求。5. the solution of tcp-stick packages5. tcp粘包的解决方案communications subsystem is responsible for communication between the client and the host. firstly, the subsystem is necessary to ensure the accuracy of the data

50、transmission, avoiding data loss- however, if you use the default tcp protocol, the interception information can not be completely simulated in the host. the reason is that the interception information is all relatively short .it is prone to stick the tcp packages, and ultimately, it will result in

51、the illusion that lost data packages.通讯子系统负责客户端和主机的通信。首先,该子系统是要保证数据传输的准确性,避免数 据丢失。但是,如果您使用默认的tcp协议,截取信息不能完全在主机上模拟。其原因是, 拦截的信息都相对较短。它很容易粘贴tcp程序包,并最终会因为错觉失去数据包。with the method2, towards tcp-stick packages caused by sender, we can avoid this problem through program setting, and make use of the operatio

52、n push supplied by tcp, which can immediately transmit the data. once tcp receives the operation, it will immediately send out data in this paragraph, rather than waiting until the buffer is full. towards the tcp-stick packages caused by receiver, we can receive data in time, through optimizing the

53、program design, simplifying the workload of the receiving process, improving the priority of the receiving process, and so on. furthermore, the data packages can be set to field structure. it is controlled by sender, and multiply received in human control. finally, we can merge them. the method can

54、completely avoid tcp-stick packages in the case of paying a little efficiency .使用方法2,针对发件人引起tcp粘包,我们可以通过不帝设置避免这个问题,并便用有tcp 提供的可以立即传输数据的操作推进。一旦tcp收到的操作,它会立即发出在木段数据,而 不是等到缓冲区满。对接收器引起的tcp粘包,我们町以及时收到数据,通过优化方案设计, 简化了接收过程的工作量,提高接收进程优先级,等等。此外,数据包可以被设置为外地结 构。它是由发件人和认为控制的加快接收器控制。敲后,我们可以将它们合并。这种方法可 以完全避免tcp粘包

55、效率低的情况。the paper selected the third method- the method designed the communication protocol, and packed all the data. before sending data, data head exmsg in a fixed-sized will be sent. the data head includes the type and size of the following data. this will receive the following data in fixed size,

56、 and the problem of tcp-stick packages will be naturally solved本文选择了第三种方法。该方法设计的通信协议,包装了所有数据。发送数据前,数据头 exmsg将固定大小发送。数据头包括以下数据类型和大小。这将获得适合大小的数据,tcp 粘包的问题将自然解决。struct exmsg3msgtype msgtype;/head message command int size;/the size of the command or data ;enum msgtype4command, /commandkeyboard, /keyboar

57、d inputmouse, /mouse actionpassword, /the connection passwordconfirm, /the return value after connection is bulit image, /imageimagequality, /image qualityimagefps, /image fpsdefinition / resolution;exmsg3 结构msgtype msgtype / /头信息命令 int size, / /命令或数据大小; 例如 msgtype4 command, / /命令keyboard, / /键盘输入mo

58、use, / /鼠标动作password, / /连接密码confirm, / /连接示的返冋值是储存卡image, / /图像imagequality, / /图像质量imagefps, / /图像帧definition / /分辨率;6. experimental result and analysis6.实验结果及分析6.1. comparisons of the image capacity6.1图像存储容呈的比较this section will compare bmp and jpeg from image quality and capacity. for the convenient of testing, the client program should be changed. the captured images not only are converted data flow to send to communications subsystem, but also are stored on the hard drive formatted in bmp and jpeg. then, we can compare their image

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论