In file remotemailbox.h:

class CRemoteMailbox

Remote mailbox client class.

Public Methods

[more]bool BroadcastMessage (char * strText, int iLen)
Sends a to all the registered mailbox.
[more] CRemoteMailbox ()
Standard class constructor.
[more]bool Connect ( char * strMailboxName, char * strServerHostName, int iPort)
Connects to server.
[more]void Disconnect ()
Disconnects from the server.
[more]bool IsConnected ()
Returns the connection status.
[more]bool ReceiveMessage (char * strSender, int* pnchSender, char * strMsgBody, int* pnchMsgBody)
Receives a message.
[more]bool SendMessage (char * strDestination, char * strText, int iLen)
Sends a message to a mailbox.
[more]void SetVerbosity (bool bVerbose)
Sets the verbosity level.
[more] ~CRemoteMailbox ()
Standard class destructor.

Protected Fields

[more]int m_iSocket
Socket file descriptor number.
[more]bool m_bConnected
Connection flag.
[more]bool m_bVerbose
Verbosity level.
[more]char m_strMailBoxName [RMBX_MAILBOX_ID_SIZE+1]
Mailbox identifier.
[more]struct sockaddr_in m_sinAddress
Server address.


Documentation

Remote mailbox client class. This class represents a mailbox that is stored and managed by a remote host on the behalf of the process that owns the mailbox itself and the object of this class which is associated to it. This class exports a number of methods that can be used to connect as a client to a mailboxd daemon on a networked server, to register onto it with an unique identifier and create a mailbox on it, to write a message to another mailbox and to read the mailbox.
oint m_iSocket
Socket file descriptor number. This is the number of the file descriptor associated to the socket that is currently in use. This number is meaningless if the socket is not actually connected; this member variable is stored for internal use only, its value is determined by the system at run-time.
See Also:
m_bConnected
IsConnected

obool m_bConnected
Connection flag. This flag indicates whether the socket is connected or not. This member variable is stored for internal use only, callers should read its value by using the IsConnected() method.
See Also:
IsConnected

obool m_bVerbose
Verbosity level. This flag indicates whether the program should generate information and progress status messages during the program execution. Messages are sent to the associated terminal. This flag is initially set to the default verbosity level; this member variable is stored for internal use only, use instead the SetVerbosity() method to modify its value.
See Also:
SetVerbosity

ochar m_strMailBoxName[RMBX_MAILBOX_ID_SIZE+1]
Mailbox identifier. This is the currently chosen mailbox identifier. This data member is meaningless is the mailbox is not connected. This member variable is stored for internal use only, use instead the Connect() method to set its value at connection time.
See Also:
IsConnected

ostruct sockaddr_in m_sinAddress
Server address. This structure contains the inet address with host and port of the server on which the mailboxd server is running. This member variable is stored for internal use only.

obool BroadcastMessage(char * strText, int iLen)
Sends a to all the registered mailbox. This function sends a message to all the mailbox that have been registered onto the mailboxd daemon, waiting for an acknowledgment return message from the server; due to this feature, the call could be blocking. Note that no destination mailbox parameter is requested.
Returns:
true if the message has been successfully delivered; false otherwise (this is a common error when this mailbox client or the destination counterpart is not connected to the server, or the destination mailbox name was misspelled;
Parameters:
strText - this is the buffer containing the message that has to be delivered; this string is limited in length to the value of the RMBX_MAX_MESSAGE_SIZE constant. Since the lenght of this buffer is separately indicated, it does not need to be a zero-terminated string, but can contain any character.
iLen - contains the lenght of the message text buffer.
See Also:
SendMessage();
RMBX_MAX_MESSAGE_SIZE

o CRemoteMailbox()
Standard class constructor. Simply initializes member variables to null or default values. It sets the verbosity to the current value of RMBX_DEFAULT_VERBOSITY, as it can be found in remotemailbox.h
See Also:
RMBX_DEFAULT_VERBOSITY
~CRemoteMailbox();

obool Connect( char * strMailboxName, char * strServerHostName, int iPort)
Connects to server. This function connects to the specificed host, trying to register a mailbox with the desired name.
Returns:
true if the connection has been successfully set up; false if it was not able to connect or there is another connected participant with the desired name.
Parameters:
strMailboxName - this is the name of the mailbox for your process you want to create.
strServerHostName - this is the name of the server you want to connect to; this argument has the default value "localhost".
iPort - this is the server port number to which you want to connect; this argument has a default value of RMBX_SERVICE_PORT, which is originally set to 12345.
See Also:
IsConnected();

ovoid Disconnect()
Disconnects from the server. Closes the communication socket, causing the server to remove the registered mailbox and to delete possible non-read messages. The operation has no effects if the socket was not connected.
See Also:
m_iSocket * @see IsConnected();

obool IsConnected()
Returns the connection status. This method returns the current status of the communication.
Returns:
s true if the mailbox-associated socket is connected to the mailboxd daemon.
See Also:
Connect();

obool ReceiveMessage(char * strSender, int* pnchSender, char * strMsgBody, int* pnchMsgBody)
Receives a message. This function receives the first message that has been enqueued in the mailbox registered onto the mailboxd daemon by the calling process. If no messages are waiting, the call is blocking.
Returns:
true if the message has been successfully retrieved; false otherwise (this is a common error when the supplied buffers are not large enough to receive the data
Parameters:
iLen - contains the lenght of the message text buffer.
See Also:
SendMessage();

obool SendMessage(char * strDestination, char * strText, int iLen)
Sends a message to a mailbox. This function sends a message to the desired destination mailbox, waiting for an acknowledgment return message from the server; due to this feature, the call could be blocking.
Returns:
true if the message has been successfully delivered; false otherwise (this is a common error when this mailbox client or the destination counterpart are not connected to the server, or the destination mailbox name was misspelled);
Parameters:
strDestination - this is the name of the destination mailbox; this string is limited to RMBX_MAILBOX_ID_SIZE characters in length.
strText - this is the buffer containing the message that has to be delivered; this string is limited in length to the value of the RMBX_MAX_MESSAGE_SIZE constant. Since the lenght of this buffer is separately indicated, it does not need to be a zero-terminated string, but can contain any character.
iLen - contains the lenght of the message text buffer.
See Also:
BroadcastMessage();
RMBX_MAX_MESSAGE_SIZE
RMBX_MAILBOX_ID_SIZE

ovoid SetVerbosity(bool bVerbose)
Sets the verbosity level. Use this function to override the default value of the verbosity. When the verbosity level is true, the object sends results and remarks to the process-associated terminal about the object's ongoing activities;
Parameters:
bVerbose - set this value to true if you want to see results and remarks on the object's ongoing activities; set it to false to disable them.
See Also:
m_bVerbose

o ~CRemoteMailbox()
Standard class destructor. Simply closes the associated socket, to disconnect pending communications, if any.
See Also:
Disconnect();


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



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