CCommonDialogElements

Back to Classes Page

Parent Class: None

This class was designed as a common base class for many dialogs, but finally I decided to keep the sockets functionality within the Document class only. So now, this class serves as the base class for Messenger Client Document class only, and it won't do any harm to combine these two.

Field Summary

Access Data Type Name
public CMessengerClientSocket * m_pSocket
public CArchive * m_pArIn
public CArchive * m_pArOut
public CSocketFile * m_pSocketFile
public CMessagePacket m_pMsgPacket
public BOOL m_bServerOnline
public int m_nPortNum
public CString m_strIPAddress

Constructor Summary

CCommonDialogElements()

Destructor Summary

virtual ~CCommonDialogElements()

Method Summary

virtual BOOL Connect2ServerSocket()
virtual bool GetConfigData()
virtual bool ProcessMessagePacket() - ABSTRACT METHOD
virtual bool ReceiveMessagePacket()
virtual bool SendMessagePacket(CMessagePacket& msgPacket)

Field Detail

m_pSocket
This socket will sends connection request to the Server Socket. It also sends and receives messages to and from Client Socket at the server end.

m_pArIn
Input stream for receiving data from server.

m_pArOut
Output stream for sending data to server.

m_pSocketFile
This stream file is associated with both input and output streams

m_pMsgPacket
Message packet object. This will be serialized across the streams to send and receive data.

m_bServerOnline
Toggle var. Used to check whether the server is online.

m_nPortNum
Port on which the client socket sends messages.

m_strIPAddress
IP address of the machine on which Chatter-jee Server is running.

Constructor Detail

CCommonDialogElements()
Initializes all pointers to NULL.

Destructor Detail

~CCommonDialogElements()
Deletes Client socket and Socket file objects.

Method Detail

Connect2ServerSocket()


GetConfigData()
Reads Chatter-jee Server's IP address and port number from configuration file, and stores them in the appropriate vars.


ProcessMessagePacket()
There's no implementation of this method, since it's abstract. It has to be implemented by a child class, in this case it's Document class


ReceiveMessagePacket()
Empties the Message Packet of all its list elements. Then receives the incoming data on the Client Socket in the Input archive object


SendMessagePacket(CMessagePacket& msgPacket)
Sends the outgoing data in the Message Packet on the Client Socket in the Output archive object. Then doesn't do anything for 100 ms, to make sure the data is gone on the socket successfully.


Back to Classes Page