MessageBox.Show("被监控的客户端IP地址不允许空", "确信正确", MessageBoxButtons.OK );
return;
}
Program.order_string = "LOGOUT";
rev_thread.send_monitor_to_client(comboBox1.Text, textBox1.Text);
}
4.2 客户端接收线程部分程序代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;//用于处理文本的
using System.Threading;
using System.Drawing;
using System.IO;//为TCP通信增加的
using System.Net;//为TCP通信增加的
using System.Net.Sockets;//为TCP通信增加的
using System.Runtime.InteropServices;//供引用API使用
using System.Diagnostics;//关闭指定进程用
namespace Client
{
public class UdpThread
{
//API的引用,主要用于对客户机的控制
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TokPriv1Luid
{
public int Count;
public long Luid;
public int Attr;
}
[DllImport("user32.dll")]//API函数锁定键盘及鼠标
private static extern void BlockInput(bool Block);
[DllImport("kernel32.dll", ExactSpelling = true)]
internal static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
|