CMessengerClientSocket

Back to Classes Page

Parent Class: CSocket

Each object of this class serves a single client. Message packets are transferred between clients and server using these sockets. The number of Client Sockets existing at the server end is always equal to the total number of clients connected at that time. Each client also has 1 client socket at its end. A client socket object is created at the server end, when the Server Socket receives a connection request from client.

Field Summary

Access Data Type Name
public CMessengerServerDoc * m_pParent
public CClientThread * m_pParentThread
public CArchive * m_pArIn
public CArchive * m_pArOut
public CSocketFile * m_pSocketFile
public CString m_strUserName
public CString m_strLoggedStatus

Constructor Summary

CMessengerClientSocket()
CMessengerClientSocket(CMessengerServerDoc *parent)

Destructor Summary

~CMessengerClientSocket()

Method Summary

void operator =(CMessengerClientSocket& sock)
virtual void OnReceive(int nErrorCode)

Field Detail

m_pParent
Document pointer. Document object acts as a parent (controller) of each client socket.

m_pParentThread
Pointer to the Thread to which this socket belongs. For each client connected to Chatter-jee server, there's 1 associated Client socket and 1 thread. Client socket connects to the client and receives data. The thread object processes the data and sends results back to client process for despatch to client.

m_pArIn
Input archive. Socket will receive data here.

m_pArOut
Output archive. Socket will send data here.

m_pSocketFile
Both input and output archive objects are associated with this file.

m_strUserName
User name of the client

m_strLoggedStatus
Indicator for knowing whether the client connected thru this socket is fully logged in or not. "L" when the login process is complete for this client.

Constructor Detail

CMessengerClientSocket()
Default Constructor. DON'T USE IT.

CMessengerClientSocket(CMessengerServerDoc *parent)
Use only this constructor. It sets the Doc pointer as the parent of this socket.

Destructor Detail

~CMessengerClientSocket()
Default Destructor.

Method Detail

operator =(CMessengerClientSocket& sock)
Equality operator overloaded to provide for the copying a Client socket to another.


OnReceive(int nErrorCode)
Called automatically when data arrives on the socket. This method sends the incoming message packet to the client thread associated with this socket for processing.


Back to Classes Page