could you help me? I need a example about how to using CSocket with mfc
-
I need a simple example Demonstration of the client-side connection service
-
I need a simple example Demonstration of the client-side connection service
can you please search codeproject before posting your question here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
can you please search codeproject before posting your question here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
Pardon sir, I've found it: CP itz thiz!!!! plz send me code plz plz! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I need a simple example Demonstration of the client-side connection service
That's simple. //CListenSocket头文件 class CListenSocket : public CSocket { public: CListenSocket(HWND hWnd=NULL); HWND m_hWnd; //事件处理窗口 virtual void OnAccept(int nErrorCode); }; //CListenSocket实现文件 #include "ListenSocket.h" CListenSocket::CListenSocket(HWND hWnd){m_hWnd=hWnd;} void CListenSocket::OnAccept(int nErrorCode) { SendMessage(m_hWnd,WM_SOCKET_MSG,SOCKET_CLNT_ACCEPT,0); CSocket::OnAccept(nErrorCode); } ... m_pListenSocket=new CListenSocket(m_hWnd); m_pListenSocket->Create(...); m_pListenSocket->Listen(); ... LRESULT CXxxDlg::OnSocketMsg(WPARAM wParam, LPARAM lParam) { UINT type=(UINT)wParam; switch(type) { case SOCKET_CLNT_ACCEPT: { CSocket* pSocket=new CSocket; if(!m_pListenSocket->Accept(*pSocket)) { delete pSocket; break; } ... } ... } }
-
I need a simple example Demonstration of the client-side connection service
I know a site that it has some examples for it its name is Codeproject! Simple CSocket Server Application Support Multiple ...[^]
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
That's simple. //CListenSocket头文件 class CListenSocket : public CSocket { public: CListenSocket(HWND hWnd=NULL); HWND m_hWnd; //事件处理窗口 virtual void OnAccept(int nErrorCode); }; //CListenSocket实现文件 #include "ListenSocket.h" CListenSocket::CListenSocket(HWND hWnd){m_hWnd=hWnd;} void CListenSocket::OnAccept(int nErrorCode) { SendMessage(m_hWnd,WM_SOCKET_MSG,SOCKET_CLNT_ACCEPT,0); CSocket::OnAccept(nErrorCode); } ... m_pListenSocket=new CListenSocket(m_hWnd); m_pListenSocket->Create(...); m_pListenSocket->Listen(); ... LRESULT CXxxDlg::OnSocketMsg(WPARAM wParam, LPARAM lParam) { UINT type=(UINT)wParam; switch(type) { case SOCKET_CLNT_ACCEPT: { CSocket* pSocket=new CSocket; if(!m_pListenSocket->Accept(*pSocket)) { delete pSocket; break; } ... } ... } }
You could write: 头文件=Header file 事件处理窗口=Window event handler :-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
That's simple. //CListenSocket头文件 class CListenSocket : public CSocket { public: CListenSocket(HWND hWnd=NULL); HWND m_hWnd; //事件处理窗口 virtual void OnAccept(int nErrorCode); }; //CListenSocket实现文件 #include "ListenSocket.h" CListenSocket::CListenSocket(HWND hWnd){m_hWnd=hWnd;} void CListenSocket::OnAccept(int nErrorCode) { SendMessage(m_hWnd,WM_SOCKET_MSG,SOCKET_CLNT_ACCEPT,0); CSocket::OnAccept(nErrorCode); } ... m_pListenSocket=new CListenSocket(m_hWnd); m_pListenSocket->Create(...); m_pListenSocket->Listen(); ... LRESULT CXxxDlg::OnSocketMsg(WPARAM wParam, LPARAM lParam) { UINT type=(UINT)wParam; switch(type) { case SOCKET_CLNT_ACCEPT: { CSocket* pSocket=new CSocket; if(!m_pListenSocket->Accept(*pSocket)) { delete pSocket; break; } ... } ... } }
-
I know a site that it has some examples for it its name is Codeproject! Simple CSocket Server Application Support Multiple ...[^]
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
There are a few examples here: http://cs.baylor.edu/~donahoo/practical/CSockets/mfc/[^]
Are you sure I need to it? :-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
I need a simple example Demonstration of the client-side connection service