# Embedded POP3 Client

Topics

:

Overview
Data Members
Functions

Overview

The embedded POP3 (Post Office Protocol 3) client is a cross platform POP3 implementation used with applications that require POP3 client/server functions. The gxsPOP3Client class is derived from the gxSocket class and conforms to RFC 1725: http://www.faqs.org/rfcs/rfc1725.html

Data Members

char gxsPOP3Client:: reply_buf[gxsBUF_SIZE]

- Buffer used to hold the last reply.

char gxs POP3Client:: command_buf[gxsBUF_SIZE]

- Buffer used to hold the last command.

int gxs POP3Client:: time_out_sec

- Number of seconds before a blocking timeout.

int gxs POP3Client:: time_out_usec

- Number of microseconds before a blocking timeout.

Functions

gxsPOP3Client::gxsPOP3Client()
gxsPOP3Client::~gxsPOP3Client()
gxsPOP3Client::ConnectClient()
gxsPOP3Client::POP3Delete()
gxsPOP3Client::POP3List()
gxsPOP3Client::POP3Login()
gxsPOP3Client::POP3Logout()
gxsPOP3Client::POP3RSet()
gxsPOP3Client::POP3Retr()
gxsPOP3Client::POP3Top()
gxsPOP3Client::RecvResponse()
gxsPOP3Client::SendCommand()
gxsPOP3Client::SetTimeOut()
gxsPOP3Client::WaitForReply()

gxsPOP3Client::gxsPOP3Client()

- Default class constructor.

gxsPOP3Client::~gxsPOP3Client()

- Class destructor.

gxSocketError gxsPOP3Client::ConnectClient(const char *host, int port = gxSOCKET_POP3_PORT)

- Public member function used to connect a POP3 client to a server. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3Delete(int message_number, char *buf, int bytes)

- Public member function used to delete a message from the POP3 server. The "message_number" variable must be a valid message number obtained by a call to the list function. The calling function must allocate sufficient memory for the "buf" variable to store the server's reply. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3List(char *buf, int bytes)

- Public member function used to list all the message numbers on the POP3 server. The calling function must allocate sufficient memory for the "buf" variable to store the server's reply. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3Login(const char *username, const char *password)

- Public member function used to logon to a POP3 server. Both the "username" and "password" variable must be null terminated strings set to a valid username and password. Returns zero no errors occur.

gxSocketError gxsPOP3Client::POP3Logout()

- Public member function used to send the POP3 "QUIT" command. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3RSet()

- Public member function used to send the POP3 "Reset" command. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3Retr(int message_number, char *buf, int bytes)

- Public member function used to retrieve a message from the POP3 server. The "message_number" variable must be a valid message number obtained by a call to the list function. The calling function must allocate sufficient memory for the "buf" variable to store the entire message or a buffer overflow will result. Returns zero if no errors occur.

gxSocketError gxsPOP3Client::POP3Top(int message_number, char *buf, int bytes)

- Public member function used to retrieve a message header from the POP3 server. The "message_number" variable must be a valid message number obtained by a call to the list function. The calling function must allocate sufficient memory for the "buf" variable to store the entire message header or a buffer overflow will result. Returns zero if no errors occur.

int gxsPOP3Client::RecvResponse(char *buf, int bytes, const char *response)

- Blocking public receive function used to read a reply from an POP3 server following a command. If the specified response is not received within the timeout period this function will return false to indicate an error. Returns true if successful.

gxSocketError gxsPOP3Client::SendCommand(const char *command, const char *response, const char *args = 0)

- Public member function used to send a command to a POP3 server and read the server's response. Returns zero if no errors occur.

void gxsPOP3Client::SetTimeOut(int seconds, int useconds)

- Public member function used to set the POP3 timeout values.

int gxsPOP3Client::WaitForReply()

- Public member function that returns false if a reply time is longer then the timeout values.

End Of Document