private void TM_Tick(object sender, System.EventArgs e)
{
listener.Start();
client = listener.AcceptTcpClient();
ns = client.GetStream();
byte[] bytes = new byte[1024];
int bytesRead = ns.Read(bytes,0,bytes.Length);
string chatshow = Encoding.UTF8.GetString(bytes,0,bytesRead);
string[] arr = chatshow.Split('|');
//ns.Write(bytes,0,bytes.Length);
TB_Show.Text += DateTime.Now+" "+arr[1] + "\r\n";
TB_Show.AppendText("");
TB_Show.ScrollToCaret();
}
在csdn上问过了,说是client = listener.AcceptTcpClient();这句会一直监听,程序就一直等到,直到有连接进来才中止,可是怎么解决呢?现在还没想到,郁闷!