資源簡介
自己寫的 vs2010 + MFC + UDP socket 聊天程序。界面簡潔,運行后只會產生一個exe,在局域網內輸入對方ip即可發送信息。在同一臺主機上也可以同時開兩個instance。
代碼片段和文件信息
#include?“StdAfx.h“
#include?“MySocket.h“
CMySocket::CMySocket(void)
{
pWnd?=?NULL;
}
CMySocket::~CMySocket(void)
{
}
void?CMySocket::AttachCWnd(CWnd?*pW)
{
????pWnd?=?pW;
}
?
void?CMySocket::OnSend(int?nErrorCode)
{
????if?(pWnd)
????pWnd->SendMessage(SOCKET_EVENT?(WPARAM)this?SEND);
CSocket::OnSend(nErrorCode);
}
void?CMySocket::OnReceive(int?nErrorCode)
{
if?(pWnd)
????????pWnd->SendMessage(SOCKET_EVENT?(WPARAM)this?RETR);????
????//?CSocket收到數據觸發?OnReceive()函數
????CSocket::OnReceive(nErrorCode);
}
void?CMySocket::OnClose(int?nErrorCode)
{
????if?(pWnd)
????????pWnd->SendMessage(SOCKET_EVENT?(WPARAM)this?CLOSE);
?????CSocket::OnClose(nErrorCode);
?}
?
void?CMySocket::OnAccept(int?nErrorCode)
{
????if?(pWnd)
????????pWnd->SendMessage(SOCKET_EVENT?(WPARAM)this?ACCEPT);
????CSocket::OnAccept(nErrorCode);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-10-12?18:38??姜勇_SimpleChat\
?????目錄???????????0??2017-10-12?18:03??姜勇_SimpleChat\Debug\
?????文件??????228352??2017-10-12?18:03??姜勇_SimpleChat\Debug\SimpleChatServer.exe
?????文件?????1464248??2017-10-12?18:03??姜勇_SimpleChat\Debug\SimpleChatServer.ilk
?????文件?????6392832??2017-10-12?18:03??姜勇_SimpleChat\Debug\SimpleChatServer.pdb
?????目錄???????????0??2017-10-12?18:02??姜勇_SimpleChat\SimpleChat\
?????目錄???????????0??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\
?????文件??????724420??2017-10-12?17:53??姜勇_SimpleChat\SimpleChat\Debug\CL.read.1.tlog
?????文件???????20148??2017-10-12?17:53??姜勇_SimpleChat\SimpleChat\Debug\CL.write.1.tlog
?????文件???????13733??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\MySocket.obj
?????文件???????68008??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\MySqlc.obj
?????文件??????????82??2017-09-28?16:24??姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.lastbuildstate
?????文件????????1107??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.log
?????文件???????28008??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.obj
?????文件???????70016??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.res
?????文件?????????853??2017-10-10?15:04??姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.vcxprojResolveAssemblyReference.cache
?????文件??????275670??2017-10-12?17:53??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatDlg.obj
?????文件???????11119??2017-09-29?13:25??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.Build.CppClean.log
?????文件?????????915??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.em
?????文件?????????980??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.em
?????文件?????????640??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.intermediate.manifest
?????文件??????????77??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.lastbuildstate
?????文件????39583744??2017-10-12?17:44??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.pch
?????文件???????????0??2017-09-29?13:26??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.write.1.tlog
?????文件?????????222??2017-09-29?13:28??姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer_manifest.rc
?????文件???????24926??2017-10-12?17:53??姜勇_SimpleChat\SimpleChat\Debug\cl.command.1.tlog
?????文件???????????2??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\li
?????文件???????????2??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\li
?????文件???????????2??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\li
?????文件???????????2??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\li
?????文件???????????2??2017-10-12?18:03??姜勇_SimpleChat\SimpleChat\Debug\li
............此處省略162個文件信息
評論
共有 條評論