Help on WinInet Programming
-
Hi Friends, I wanna some help on WinInet Programming. I am writing a VC++ client which is supposed to communicate a web Server written in C#.net. I am able to send a request to Web Server but how to read the contents send by WebServer can anybody help me in this ? Following is my code: HINTERNET hOpen,hConnect,hRequest; BOOL retval; DWORD dwErrorCode;//=12032; CString data="cmdCreateSessionID"; hOpen=InternetOpen("HttpApp/1.0", INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0); hConnect=InternetConnect(hOpen, SERVER_LAN_NAME,4000, NULL,NULL, INTERNET_SERVICE_HTTP,0,0); CString method="POST"; CString url="index.html"; DWORD dwFlags=0; hRequest=HttpOpenRequest(hConnect,method,url, NULL, NULL, NULL, dwFlags, 0); DWORD R1=GetLastError(); HttpSendRequest(hRequest,NULL,0,data.GetBuffer(), data.GetLength()); dwErrorCode = hRequest ? ERROR_SUCCESS : GetLastError(); CString lpBuffer; INTERNET_BUFFERS dwStruct; DWORD dwNumberOfBytesToRead,dwNumberOfBytesRead; dwNumberOfBytesRead=dwNumberOfBytesToRead=0; BOOL retReadFile=InternetReadFile(hRequest,&lpBuffer,dwNumberOfBytesToRead, &dwNumberOfBytesRead); In the InternetReadFile function i am unable to read any buffer. With Rgds VC++ Girish Software Developer