static void OnSendToComplete(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                SendToAsyncResult thisPtr             = (SendToAsyncResult)result.AsyncState;
                Exception         completionException = null;
                int count = 0;

                try
                {
                    count = thisPtr.socket.EndSendTo(result);
                }
                catch (SocketException socketException)
                {
                    completionException = ConvertNetworkError(socketException, thisPtr.size - thisPtr.offset, TransferDirection.Send, thisPtr.timeToLive);
                }
                catch (Exception ex)
                {
                    if (Fx.IsFatal(ex))
                    {
                        throw;
                    }

                    completionException = ex;
                }

                if (completionException != null)
                {
                    thisPtr.Complete(false, completionException);
                }
                else
                {
                    thisPtr.Complete(count, false);
                }
            }
 public int EndSendTo(IAsyncResult result)
 {
     return(SendToAsyncResult.End(result));
 }