主题:client编程的问题!
主要程序如下:
private void button1_Click(object sender, EventArgs e)
{
TcpClient _client = new TcpClient("127.0.0.1", 10000);
string _date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
NetworkStream ns = _client.GetStream();
StreamReader sr = new StreamReader(ns );
string msg = sr.ReadLine();
listBox1.Items.Add(_date + "\n"+msg);
}
为什么点击button1却没响应呢?服务器程序没什么问题!
private void button1_Click(object sender, EventArgs e)
{
TcpClient _client = new TcpClient("127.0.0.1", 10000);
string _date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
NetworkStream ns = _client.GetStream();
StreamReader sr = new StreamReader(ns );
string msg = sr.ReadLine();
listBox1.Items.Add(_date + "\n"+msg);
}
为什么点击button1却没响应呢?服务器程序没什么问题!