C#Socket客户端如何自动连接并传输数据
2020/6/15 21:25
代码片
.
//与服务器连接
private void ConnectServerAutoSend()
{
//开启线程
thread = new Thread(AutoConnect);
thread.IsBackground = true;
thread.Start();
}
//线程调用自动连接方法
private void AutoConnect()
{
while (true)
{
Thread.Sleep(5000);
//创建Socket套接字对象
socket = new Socket