public void EndSend(IAsyncResult asyncResult)
{
AsyncSendDataResult asyncSendResult = (AsyncSendDataResult)asyncResult;
if (!asyncSendResult.IsCompleted) {
asyncSendResult.AsyncWaitHandle.WaitOne();
}
if (asyncSendResult.CompletedWithException) {
throw asyncSendResult.AsyncException;
}
}