Problem while sending Thru CAsyncSocket::Send()

From: Thorsten Viel (nospam_at_tviel.de)
Date: 04/01/04


Date: Thu, 01 Apr 2004 21:03:51 +0200

Hi,

Iam using CAsyncSocket for let clients connect to my App.

Now I tried to send Data to the client.

After connecting from client is established i receive the READYTOSEND.

First I send the content of a textarea when clicked on a button like
this:

((CFCSDlg*)m_pWnd)->GetConnectSocket()->Send((LPCTSTR)
m_sCommand,m_sCommand.GetLength()+1);

Everything works well, even more than 1 time clicking the send button

Then I tried to send thru the socket on a function which is called
after receiving data.

    iSent = Send((LPCTSTR)Data, Len+1); // Absenden der Daten
        if (iSent==SOCKET_ERROR)
                {AfxMessageBox("Server send error");

The result:

Unhandled exception at 0x004059c5 in FCS.exe: 0xC0000005: Access
violation reading location 0x000002dc.

What is the difference between Sending after click and by a function
after receiving?

Thanks in advance