Knowledge Base Nr: 00043 MYSOCK.cpp - http://www.swe-kaiser.de
Downloads:
MFC: tcp-socketclient mit CAsyncSocket
non-blocked - aber zeilenweises lesen einstellbar
mit einfachem dialog sample
class CSocketclientDlg; //should be replaced
class CMySocket : public CAsyncSocket
{
// Operations
public:
CMySocket();
virtual ~CMySocket();
void SetCallback(CSocketclientDlg* pApp) { m_pApp = pApp; }
void SetLineMode(bool bLineMode = true) { m_bLineMode = bLineMode; }
protected:
//callback (should be changed)
CSocketclientDlg* m_pApp;
//state
bool m_bLineMode;
bool m_bInitialized;
//buffer handling
char m_cBuffer[MAXLEN];
int m_nCurr;
};