help in csocket code plzzzz
-
SIR, I dont know how to use csocket class in managed code. any bode can help me. plz read this code clearly and namespace mfcdll { class CListeningSocket : public CSocket { public: CListeningSocket(){} virtual ~CListeningSocket(void){} //{{AFX_VIRTUAL(CListeningSocket) public: virtual void OnAccept(int nErrorCode); //}}AFX_VIRTUAL // Generated message map functions //{{AFX_MSG(CListeningSocket) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG }; //*********************************************** public __gc class M_listeningsocket { public: M_listeningsocket(); ~M_listeningsocket(void); CListeningSocket *ptr3; //{{AFX_VIRTUAL(M_listeningsocket) public: virtual void OnAccept(int nErrorCode); //}}AFX_VIRTUAL void Create(UINT port); bool Listen(void); }; } //******************************************************** ///file name (m_listeningsocket.cpp) M_listeningsocket::M_listeningsocket() { ptr3=new CListeningSocket( ); } M_listeningsocket::~M_listeningsocket(void) { delete ptr3; } void mfcdll::M_listeningsocket::OnAccept(int nErrorCode) { ptr3->OnAccept(nErrorCode); } void mfcdll::M_listeningsocket::Create(UINT port) { if(ptr3->Create(port)) MessageBox(0,"create succ....",0,0); else MessageBox(0,"create not succge....",0,0); } bool mfcdll::M_listeningsocket::Listen(void) { if(ptr3->Listen()) { MessageBox(0,"Listen succ....",0,0); return true; } else { MessageBox(0,"Listen not succ....",0,0); return false; } } //******************************************************** if(ptr3->Create(port)) i dont know why it return false in above line what is mistake in the above code can any body tell me i will be very thank full to u. r00d0034@yahoo.com