I need help and a proper method to download a file viz httpget request i ve tried the followin code but its not helping
tell me where m doin things wrong, i need a quick help
thanks in advance
Mehroz
- Code:
ERESULT ClassMain::OnInit(ENATIVETYPE instance)
{
if (ecd.net[0]->Init(ECONN_SOCKET, this) == E_OK)
{
ClassEConsole::MsgWindow("Socket formed");
ecd.net[0]->SendHTTPGet("http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget-1.9.1.exe");
ClassEConsole::MsgWindow("Server formed");
stack.Alloc(32768);
ClassEConsole::MsgWindow("test");
}
else
{
ClassEConsole::MsgWindow("Socket not formed");
}
return(E_OK);
}
- Code:
void ClassMain::OnNetMessage(unsigned char connection, long id, long msg, long bufsize, unsigned char *buffer)
{
EHTTPRESPONSE_INFO info;
if (msg == ENET_SERVERFOUND)
{
ClassEConsole::MsgWindow("hi");
//The client has been connected
}
if (msg == ENET_RECEIVEDATA)
{
stack.Push(buffer, bufsize);
}
if(msg == ENET_CLOSEDSOCKET)
{
/*if (stack.GetResponseInfo(&info))
{*/
stack.GetResponseInfo(&info);
if(stack.BodySize() == 0)
{
unsigned char *bodydata = NULL;
unsigned long bodydatasize;
bodydata = (unsigned char *)ClassEMemory::Alloc(stack.BodySize());
if (bodydata != NULL)
{
stack.GetBody(bodydata, bodydatasize);
ClassEMemory::DeAlloc(bodydata);
}
//}
//}
stack.Clear();
}
}
}
tell me where m doin things wrong, i need a quick help
thanks in advance
Mehroz