111,093
社区成员




Task.Factory.StartNew(new Action(() =>
{
while (true)
{
int receiveLength = Rcconnect.client.Receive(result);
listBox1.Invoke((Action)(() =>
{
listBox1.Items.Add(DateTime.Now + " RecConext>" + Encoding.GetEncoding("GB2312").GetString(result, 0, receiveLength));
}));
}
}));
[/quote]
恩,失误,写漏了,没注意到有控件对象Task.Factory.StartNew(new Action(() =>
{
while (true)
{
int receiveLength = Rcconnect.client.Receive(result);
listBox1.Invoke((Action)(() =>
{
listBox1.Items.Add(DateTime.Now + " RecConext>" + Encoding.GetEncoding("GB2312").GetString(result, 0, receiveLength));
}));
}
}));
Task.Factory.StartNew(new Action(() =>
{
while (true)
{
int receiveLength = Rcconnect.client.Receive(result);
listBox1.Items.Add(DateTime.Now + " RecConext>" + Encoding.GetEncoding("GB2312").GetString(result, 0, receiveLength));
}
}));