private Thread mainServerThread;
private Socket sC2S ; private void Client_Load(object sender, System.EventArgs e)
{
mainServerThread = new Thread (new ThreadStart (clientStart));

mainServerThread.Start();
} IPAddress IPa = IPAddress.Parse("192.168.2.119"); IPEndPoint IPe = new IPEndPoint(IPa , 9000); sC2S = new Socket(IPe.AddressFamily, SocketType.Stream, ProtocolType.Tcp); mainServerThread.Abort();
sC2S.Shutdown(SocketShutdown.Both);
sC2S.Close();全部源码:http://www.jp168.cn/socket.rar