Windows/Linux OS上C ++中的网络项目 [英] Network project in c++ on windows/linux OS

查看:63
本文介绍了Windows/Linux OS上C ++中的网络项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生/女士,
我是MCA学生.我想在c ++中做一个网络项目-"Process dispatcher".
该项目的基本思想是-LAN中有许多相互连接的计算机.在服务器计算机上,管理员应该能够查看每个客户端正在运行的进程,并且管理员应该有权终止/杀死客户端计算机上任何不需要的进程.
这对于例如在计算机实践,在线考试中不应出于复制目的而打开任何浏览器等功能很有用.
所以我的问题是我们可以在c ++中实现这种想法吗?如果是,请plz指导我尽快做到这一点.

Hello sir/madam,
I am MCA student. I want to do a networking project-"Process dispatcher" in c++.
Basic idea behind this project is-There are many computers connected to each other in LAN. On server machine,admin should be able to view each of the client''s running processes and admin should have rights to end/kill any unwanted process on client''s machine.
This can be useful for e.g.-during computer practicals,online exams one should not be able to open any browser for copy purpose etc.
So my question is can we implement such idea in c++?If yes,plz guide me ho to do that as soon as possible.

推荐答案

Frnd!

是的,您可以在C ++中执行此操作.


要连接任何服务器:请使用
HANDLE hServer = WTSOpenServer(char * ServerName);
这会将句柄返回到服务器.

使用此句柄,使用api
枚举服务器计算机上的进程.
Frnd!

yes you can do this in C++.


To connecto any server : use
HANDLE hServer = WTSOpenServer(char *ServerName);
This returns the handle to the server.

With this handle, enumerate the process on the server machine using the api

DWORD pCount = 0;
PWTS_PROCESS_INFO ppProcessInfo,pProcess;




WTSEnumerateProcesses(hServer,0,1,& ppProcessInfo,& pCount);




WTSEnumerateProcesses(hServer,0,1,&ppProcessInfo,&pCount);

for(int i = 0; i < pCount; i++)
{
    pProcess->pProcessName;
    pProcess++;
}



具有这种过程结构.迭代"iexplore.exe",如果存在则终止进程!

希望对您有帮助.



With this process structure. Iterate for the "iexplore.exe" and if it exists kill the process!

Hope this will help u.


您至少需要三个协作的应用程序:
  • 在Windows客户端上运行的Windows应用程序,能够列出和终止任何本地进程(并与服务器上运行的应用程序进行通信).
  • 在Linux上运行的Linux应用程序客户端,能够列出和终止任何本地进程(并与服务器上运行的应用程序进行通信).
  • 服务器上运行的应用程序(Windows或Linux,具体取决于服务器操作系统),能够与上述应用程序通信.
You need (at least) three cooperating applications:
  • A Windows application, running on Windows clients, able to list and terminate any local process (and to communicate with the application running on the server).
  • A Linux application, running on Linux clients, able to list and terminate any local process (and to communicate with the application running on the server).
  • An application running on the server (Windows or Linux, depending precisely on server OS), able to communicate with the above applications.


这篇关于Windows/Linux OS上C ++中的网络项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆