|
[code=csharp]private struct SendMessageStates
{
public SendMessageDelegate d;
public IAsyncResult result;
}
/// <summary>异步向服务器端发送数据</summary>
private void AsyncSendMessage(string message)
{
SendMessageDelegate d = new SendMessageDelegate(SendMessage);
IAsyncResult result = d.BeginInvoke(message, null, null);
while (result.IsCompleted == false)
{
if (isExit)
{
return;
}
Thread.Sleep(50);
}
//下面这段没看懂,帮忙解释下
SendMessageStates states = new SendMessageStates();
states.d = d;
states.result = result;
Thread t = new Thread(FinishAsyncSendMessage);
t.IsBackground = true;
t.Start(states);
}[/code]
|
|