EndSend() 공개 메소드

Ends a pending asynchronous send.
is a null reference (Nothing in Visual Basic). was not returned by a call to the method. was previously called for the asynchronous read. An operating system error occurs while accessing the SecureSocket. The SecureSocket has been closed. An error occurs while communicating with the remote host.
public EndSend ( IAsyncResult asyncResult ) : int
asyncResult IAsyncResult The result of the asynchronous operation.
리턴 int
 /// <summary>
 /// Called when the bytes have been sent to the remote server
 /// </summary>
 /// <param name="asyncResult">The <see cref="IAsyncResult"/> representing the asynchronous call.</param>
 private void OnBytesSent(IAsyncResult asyncResult)
 {
     try {
         int sent = Socket.EndSend(asyncResult);
         sent += (int)asyncResult.AsyncState;
         if (sent == WriteResult.Buffer.Length)
         {
             OnWriteComplete(null);
         }
         else
         {
             Socket.BeginSend(WriteResult.Buffer, sent, WriteResult.Buffer.Length - sent, SocketFlags.None, new AsyncCallback(OnBytesSent), sent);
         }
     } catch (Exception e) {
         OnWriteComplete(e);
     }
 }