CHttpFile::EndRequest Fails
-
I am trying to use POST url to the server using CInternetSession ,CHttpConnection,CHttpFile But I am getting exception when excuting EndRequest The format i have to post is: POST /axis-cgi/audio/transmit.cgi HTTP/1.0\r\n Content-Type: audio/basic\r\n Content-Length: 9999999\r\n Connection: Keep-Alive\r\n Cache-Control: no-cache\r\n \r\n <Audio data> <Audio data> <Audio data> My Code is : CInternetSession session; CHttpConnection *m_pConnection; CHttpFile* pHTTP; CString strPreFileData; strPreFileData = "Content-Type: audio/basic\r\n"; strPreFileData += "Content-Length: 9999999\r\n"; strPreFileData += "Connection: Keep-Alive\r\n"; strPreFileData += "Cache-Control: no-cache\r\n"; strPreFileData += "\r\n"; CFile fTrack; if (FALSE == fTrack.Open(strFullPath, CFile::modeRead )) { AfxMessageBox(_T("Unable to open the file.")); return FALSE; } dwReadLength = fTrack.Read(pBuffer, 200); m_pConnection=session.GetHttpConnection("10.200.11.63", (INTERNET_PORT)80, "root", "root"); pHTTP = m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "axis-cgi/audio/transmit.cgi"); pHTTP->AddRequestHeaders(strPreFileData); pHTTP->SendRequestEx(240,HSR_INITIATE,0); pHTTP->Write(pBuffer, 240); pHTTP->EndRequest(); Please Help me regarding this S.Yamini