Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

NumbChucks

Winsock for e-mail, what is the next step

This topic is 5810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am studying winsock, and I need to know based on the code below, what is the next step. I am writing an application for e-mail. If you just tell me a function or create this object, I will look it up in the help files. As you will see below, I am a comment freak. Thanks for your help. [ /* Every computer has a local host name */ /* This example retrieves the host name of the PC in runs in */ /* Make sure to include the following library in your project: ws2_32.lib */ #include <iostream> /* input output stream */ #include <conio.h> /* used for getch */ #include <winsock.h> /* the winsock header file */ /* Make sure to go to projects, settings, link tab, and type in the following library, which needs to be included with your project ws2_32.lib */ #define n ''\n'' /* my defines */ #define t ''\t'' /* my defines */ using namespace std; /* global namespace */ int main() /* beginning of main */ { WSADATA w; /* Creating a WSADATA structure */ WSAStartup(0x0202,&w); /* Calling the WSA initialization function, this function will fill in the WSADATA structure */ char ac[80]; /* Any large number you want. I hit it with 80 because, I had to much coffee this morning */ /* gethostname fills and array with the host name of your PC */ /* It returns a SOCKET_ERROR type */ if(gethostname(ac, sizeof(ac)) == SOCKET_ERROR) { cerr << "Error " << WSAGetLastError()/* display numeric error */ << " when getting local host name." << endl; return 1; } cout << "Host name is " << ac << "." << endl; /* Displays the host name */ WSACleanup(); /* Whenever you are done with your WinSock session, make sure to call this function */ getch(); /* get keyboard stroke */ return 0; } /* end of main */ ]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Surely this code doesn''t compile?

if you define n to ''\n'' (and t to ''\t'') won''t that replace every n with ''\n'' and every t with ''\t''

eg
using namespace std;
becomes
usi''\n''g ''\n''amespace s''\t''d;

Anyway...

I''m sure there are email librarys out there, but I don''t know any. Try sourceforge or google.

If you want to roll your own then the protocol is described in the RFCs. The protocoles are POP3, IMAP and SMTP. Goto google search for SMTP RFC and so on.

Here''s the Pop3 to get you started.
http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1939.html

The basic idea is that once you connect to the server (standard winsock work here, make sure you get the right port) you send short pieces of text messages and the server sends you different bits of the email back

eg you send
RETR 1
and the server sends you the first message.

Hope that helped.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!