public void send_monitor_to_client(string local_ip_address,string dest_ip_address,bool send_all_screen)
{
//IP地址及端口信息
string command_string = "##IP:" + local_ip_address + "#IPEND###PORT:" + local_port.ToString() + "#PORTEND##";
if (true == send_all_screen)
{
command_string = command_string + "#SENDALL#";
}
//添加控制客户机的命令串,在客户端寻找ORDER:与CMD_END##之间的串
command_string = command_string+ "ORDER:" + Program .order_string ;
command_string = command_string + "#CMD_END##";
UdpClient sender = new UdpClient();
IPEndPoint endPoint = (new IPEndPoint(IPAddress.Parse(dest_ip_address), GlobalConsts.LOCAL_WAIT_PORT));
try
{
byte[] bytes = Encoding.ASCII.GetBytes(command_string);
sender.Send(bytes, bytes.Length, endPoint);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
sender.Close();
}
}
private void rev_data()
{
rev_data_udp = new UdpClient(new IPEndPoint(IPAddress.Any, local_port));
IPEndPoint remoteHost = null;
|