public byte[] EndReceive(IAsyncResult asyncResult)
{
AsyncReceiveDataResult asyncReceiveResult = (AsyncReceiveDataResult)asyncResult;
if (!asyncReceiveResult.IsCompleted) {
asyncReceiveResult.AsyncWaitHandle.WaitOne();
}
if (asyncReceiveResult.CompletedWithException) {
throw asyncReceiveResult.AsyncException;
}
return asyncReceiveResult.AsyncResult;
}