class PPOP3: public PInternetProtocol

A TCP/IP socket for the Post Office Protocol version 3.

Inheritance:


Protected Methods

[more]virtual PINDEX ParseResponse ( const PString & line )
Parse a response line string into a response code and any extra info on the line.


Inherited from PInternetProtocol:

Public Methods

ovirtual BOOL Read( void * buf, PINDEX len )
ovirtual BOOL Write( const void * buf, PINDEX len )
ovoid SetReadLineTimeout( const PTimeInterval & t )
ovirtual BOOL Connect( const PString & address, WORD port = 0 )
ovirtual BOOL Accept( PSocket & listener )
oconst PString& GetDefaultService() const
oPIPSocket* GetSocket() const
ovirtual BOOL WriteLine( const PString & line )
ovirtual BOOL ReadLine( PString & line, BOOL allowContinuation = FALSE )
ovirtual void UnRead( int ch )
ovirtual BOOL WriteCommand( PINDEX cmdNumber )
ovirtual BOOL ReadCommand( PINDEX & num, PString & args )
ovirtual BOOL WriteResponse( unsigned numericCode, const PString & info )
ovirtual BOOL ReadResponse()
ovirtual int ExecuteCommand( PINDEX cmdNumber )
oint GetLastResponseCode() const
oPString GetLastResponseInfo() const


Inherited from PIndirectChannel:

Public

Construction

Overrides from class PObject

Overrides from class PChannel

Channel establish functions

Protected Fields

oPChannel* readChannel
oBOOL readAutoDelete
oPChannel* writeChannel
oBOOL writeAutoDelete
oPReadWriteMutex channelPointerMutex

Protected Methods

ovirtual BOOL OnOpen()


Inherited from PChannel:

Public Methods

ostatic BOOL ConvertOSError( int libcReturnValue, Errors & lastError, int & osError )

Public

Information functions

Reading functions

Writing functions

Miscellaneous functions

Error functions

Protected Fields

oint os_handle
oErrors lastErrorCode[NumErrorGroups+1]
oint lastErrorNumber[NumErrorGroups+1]
oPINDEX lastReadCount
oPINDEX lastWriteCount
oPTimeInterval readTimeout
oPTimeInterval writeTimeout

Protected Methods

ovirtual BOOL ConvertOSError( int libcReturnValue, ErrorGroup group = LastGeneralError )
oBOOL SetErrorValues( Errors errorCode, int osError, ErrorGroup group = LastGeneralError )
oint ReadCharWithTimeout( PTimeInterval & timeout )


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions


Documentation

A TCP/IP socket for the Post Office Protocol version 3.

When acting as a client, the procedure is to make the connection to a remote server, then to retrieve a message using the following procedure: <PRE><CODE> PPOP3Client mail("popserver"); if (mail.IsOpen()) { if (mail.LogIn("Me", "password")) { if (mail.GetMessageCount() > 0) { PUnsignedArray sizes = mail.GetMessageSizes(); for (PINDEX i = 0; i < sizes.GetSize(); i++) { if (mail.BeginMessage(i+1)) mail.Read(myMessage, sizes[i]); else PError << "Error getting mail message." << endl; } } else PError << "No mail messages." << endl; } else PError << "Mail log in failed." << endl; } else PError << "Mail conection failed." << endl; </PRE></CODE>

When acting as a server, a descendant class would be created to override at least the <A>HandleOpenMailbox()</A>, <A>HandleSendMessage()</A> and <A>HandleDeleteMessage()</A> functions. Other functions may be overridden for further enhancement to the sockets capabilities, but these will give a basic POP3 server functionality.

The server socket thread would continuously call the <A>ProcessMessage()</A> function until it returns FALSE. This will then call the appropriate virtual function on parsing the POP3 protocol.

ovirtual PINDEX ParseResponse( const PString & line )
Parse a response line string into a response code and any extra info on the line. Results are placed into the member variables <CODE>lastResponseCode</CODE> and <CODE>lastResponseInfo</CODE>.

The default bahaviour looks for a space or a '-' and splits the code and info either side of that character, then returns FALSE.

Returns:
Position of continuation character in response, 0 if no continuation lines are possible.


Direct child classes:
PPOP3Server
PPOP3Client

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.