如题
多谢

解决方案 »

  1.   

    函数返回!=SOCKET_ERROR 即为函数执行成功,但对方是否收到需要由程序进行其他处理。
      

  2.   

    看返回值
    see MSDN Sample:
    // CMyAsyncSocket is derived from CAsyncSocket and defines the 
    // following variables:
    //    CString      m_sendBuffer;   //for async send
    //    int      m_nBytesSent;
    //    int      m_nBytesBufferSize;void CMyAsyncSocket ::OnSend(int nErrorCode)
    {
       while (m_nBytesSent < m_nBytesBufferSize)
       {
          int dwBytes;      if ((dwBytes = Send((LPCTSTR)m_sendBuffer + m_nBytesSent, 
             m_nBytesBufferSize - m_nBytesSent)) == SOCKET_ERROR)
          {
             if (GetLastError() == WSAEWOULDBLOCK) break;
             else
             {
                TCHAR szError[256];
                wsprintf(szError, "Server Socket failed to send: %d", 
                   GetLastError());
                Close();
                AfxMessageBox (szError);
             }
          }
          else
          {
             m_nBytesSent += dwBytes;
          }
       }
       if (m_nBytesSent == m_nBytesBufferSize)
          {
             m_nBytesSent = m_nBytesBufferSize = 0;
             m_sendBuffer = "";
          }
       CAsyncSocket::OnSend(nErrorCode);
    }
    if (dwBytes>=0) 就是每次send的字节数
    if (dwBytes = -1)就有错误(除WSAEWOULDBLOCK 发送缓冲满)
      

  3.   

    你应该了解一下同步异步Socket的区别。