using System;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
private Socket client;
public bool isConnected = true;
public bool Open(string ip, string port)
{
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(ip), Convert.ToInt32(port));
this.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
this.client.Connect(remoteEP);
return true;
}
部分代码如上: