POP3 Client Program
From Web (09.06.1997)
Table of Contents
Create a Project (Application) in Visual C++ (we have used MSVC 4.0)
Files in the Project:
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
void abc(char *p)
{ FILE *fp=fopen("z.txt","a+");
fprintf(fp,"%s\n",p);
fclose(fp);
}
struct sockaddr_in A;
WSADATA W;
SOCKET S;
char aa[60000];
int i;
struct hostent *H;
char R[60000];
int _stdcall WinMain(HINSTANCE ii, HINSTANCE j, char * k, int l)
{
WSAStartup (0x101, &W);
S = socket(AF_INET, SOCK_STREAM,0);
A.sin_family=AF_INET;
A.sin_port = htons(110);
H=gethostbyname("giasbm01.vsnl.net.in");
A.sin_addr.s_addr=*((unsigned long *) H->h_addr);
i=connect(S,(struct sockaddr *) &A,sizeof(A));
sprintf(aa,"connect %d",i);
abc(aa);
i=recv(S,R,10000,0);
sprintf(aa,"recv %d R %s",i,R);
abc(aa);
strcpy(R,"USER vmukhi\r\n");
i=send(S,R,strlen(R),0);
sprintf(aa,"send %d ",i);
abc(aa);
i=recv(S,R,10000,0);
sprintf(aa,"recv %d R %s",i,R);
abc(aa);
strcpy(R,"PASS abc101d\r\n");
i=send(S,R,strlen(R),0);
sprintf(aa,"send %d ",i);
abc(aa);
i=recv(S,R,10000,0);
sprintf(aa,"recv %d R %s",i,R);
abc(aa);
strcpy(R,"STAT\r\n");
i=send(S,R,strlen(R),0);
sprintf(aa,"send %d ",i);
abc(aa);
i=recv(S,R,10000,0);
sprintf(aa,"recv %d R %s",i,R);
abc(aa);
strcpy(R,"RETR 1\r\n");
i=send(S,R,strlen(R),0);
sprintf(aa,"send %d ",i);
abc(aa);
i=recv(S,R,60000,0);
sprintf(aa,"recv %d ",i);
abc(aa);
sprintf(aa,"R...... %s",R);
abc(aa);
i=recv(S,R,60000,0);
sprintf(aa,"recv %d ",i);
abc(aa);
sprintf(aa,"R...... %s",R);
abc(aa);
MessageBox(0,"hi","over",0);
return 0;
}
Have any suggestions, comments, ideas, cracked code, feedback. Feel free to
get in touch with us.
Move back to the
Vijay Mukhi's Technology Cornucopia Page
to learn more about the other new Internet Technologies.
Vijay Mukhi's Computer Institute
VMCI, B-13, Everest Building, Tardeo, Bombay 400 034, India
E-mail:vmukhi@giasbm01.vsnl.net.in Tel : 91-22-496 4335 /6/7/8/9 Fax : 91-22-307 28 59
http://www.neca.com/~vmis