Click here to Skip to main content
15,885,757 members
Articles / Programming Languages / C++

IPCWorkshop

Rate me:
Please Sign up or sign in to vote.
4.91/5 (43 votes)
29 Jan 20037 min read 156.6K   4.5K   93  
This article describes a data transfer over various IPC mechansisms
//////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                            
// IPCWorkshop							                                      
//                                                                            
// Environment:     Visual C++ 6.0, Windows 2000                              
//                                                                            
// Notes:	Class CDerivedSocket. Encapsultaed over CSocket. Creates both
//			socket server and socket client. Overrides only two methods 
//			just to receive an pointer from the client.  
//////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __DERIVEDSOCKET_H__
#define __DERIVEDSOCKET_H__

class CDerivedSocket : public CSocket
{
public:
	CDerivedSocket();
	~CDerivedSocket();

	// Attributes
	void SetDataSize(int);
	int GetDataSize() const;

	// Operations
	void Initialize(bool, LPCTSTR pHostAddress = "200.125.150.47", UINT pHostPort = 5000);
	void Listen(UINT, LPARAM);
	bool Send(char*, int);
	virtual void OnReceive( int nErrorCode );
	virtual void OnAccept( int nErrorCode );	

protected:
	int m_nDataSize;
	LPARAM m_nLParam;
	static UINT m_nTransferMessage;
};

////////////////////////////////////////////////////////////////////////////////
// Inline Functions															  //
////////////////////////////////////////////////////////////////////////////////
inline void CDerivedSocket::SetDataSize(int pDataSize)
{
	m_nDataSize = pDataSize;	
}

inline int CDerivedSocket::GetDataSize() const
{
	return m_nDataSize; 	
}

#endif //__DERIVEDSOCKET_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
Iam a software developer from Chennai, India. I've been working mainly under windows environment.I am attracted to various programming languages including : C/C++, Python. I've been programming VC++/MFC, ATL/COM, Lex & Yacc and database design/development ( SQL/Oracle ) for the past two years.



Comments and Discussions