Well for MFC I believe you can just make a CAsyncSocket Object then in the class put your prototype functions? (In a class what would you call that?) Anyways its probably best if you learn the WinAPI way however Objects will work as well. Here is a sample of how you would probably download an image:
The above is for MFC only, don't forget to include stdafx.h and winsock.h and you'll probably have to Link to: Ws2_32.lib
class CObjects : public CAsyncSocket
virtual void OnClose(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnReceive(int nErrorCode);
void CObjects::OnClose(int nErrorCode)
MessageBox(NULL,"They closed the connection!",NULL,MB_OK);
void CObjects::OnConnect(int nErrorCode)
void CObjects::OnReceive(int nErrorCode)
//If this is the picture download it and write it to a file using Receive, and WriteFile. Be careful, HTTP server may send unwanted data without asking for it!
//Now to connect you first have to create a socket, then connect to the domain.
MySocket.Create(0,SOCK_STREAM,FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE); //All you really need in this case is FD_READ, FD_CLOSE, FD_CONNECT.
MySocket.Connect("www.somedomain.com",80); //Port 80 is default HTTP Protocol Port.
//Now you'll want to send data to get your picture!:
You'll have to use MySocket.Send(lpBuf, lpBufLen, 0);
To get a picture I believe you send the following: "GET SomePicture.jpg" and NEVER forget your CRLF's in Data Transfer.
//And when they send you something you'll retreive it through your CObjects::OnReceive function using MySocket.Receive or by simply using Receive.
Good luck and I hope that I helped.