資源簡介
《應用層通信協議開發淺析》博文代碼:
基于TLV的應用層協議開發示例。

代碼片段和文件信息
//?ChatRoom.cpp?:?定義應用程序的類行為。
//
#include?“stdafx.h“
#include?“ChatRoom.h“
#include?“ChatRoomDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
//?CChatRoomApp
BEGIN_MESSAGE_MAP(CChatRoomApp?CWinApp)
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
//?CChatRoomApp?構造
CChatRoomApp::CChatRoomApp()
{
//?TODO:?在此處添加構造代碼,
//?將所有重要的初始化放置在?InitInstance?中
}
//?唯一的一個?CChatRoomApp?對象
CChatRoomApp?theApp;
//?CChatRoomApp?初始化
BOOL?CChatRoomApp::InitInstance()
{
//?如果一個運行在?Windows?XP?上的應用程序清單指定要
//?使用?ComCtl32.dll?版本?6?或更高版本來啟用可視化方式,
//則需要?InitCommonControls()。否則,將無法創建窗口。
InitCommonControls();
CWinApp::InitInstance();
if?(!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return?FALSE;
}
AfxEnableControlContainer();
//?標準初始化
//?如果未使用這些功能并希望減小
//?最終可執行文件的大小,則應移除下列
//?不需要的特定初始化例程
//?更改用于存儲設置的注冊表項
//?TODO:?應適當修改該字符串,
//?例如修改為公司或組織名
SetRegistryKey(_T(“應用程序向導生成的本地應用程序“));
CChatRoomDlg?dlg;
m_pMainWnd?=?&dlg;
INT_PTR?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?在此放置處理何時用“確定”來關閉
//對話框的代碼
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?在此放置處理何時用“取消”來關閉
//對話框的代碼
}
//?由于對話框已關閉,所以將返回?FALSE?以便退出應用程序,
//?而不是啟動應用程序的消息泵。
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1424??2009-06-23?20:08??TEST.dsw
?????文件??????70144??2009-06-23?21:46??TEST.opt
?????文件????????127??2011-10-27?22:04??TEST工程說明.txt
?????文件???????4710??2009-06-23?20:05??1-ChatRoom\1-ChatRoom.dsp
?????文件???????8402??2009-06-23?21:46??1-ChatRoom\1-ChatRoom.plg
?????文件??????41948??2009-06-23?20:08??1-ChatRoom\ChatRoom.aps
?????文件???????1123??2009-06-18?07:21??1-ChatRoom\ChatRoom.clw
?????文件???????1570??2009-05-16?23:10??1-ChatRoom\ChatRoom.cpp
?????文件????????449??2006-03-20?21:33??1-ChatRoom\ChatRoom.h
?????文件???????5374??2006-03-22?10:18??1-ChatRoom\ChatRoom.rc
?????文件????????631??2009-05-20?10:47??1-ChatRoom\ListenSocket.cpp
?????文件????????344??2009-05-18?13:59??1-ChatRoom\ListenSocket.h
?????文件???????3615??2009-05-15?10:49??1-ChatRoom\ReadMe.txt
?????文件????????817??2006-03-20?21:54??1-ChatRoom\resource.h
?????文件???????5776??2009-05-25?15:12??1-ChatRoom\ServerSocket.cpp
?????文件???????1424??2009-06-18?13:08??1-ChatRoom\ServerSocket.h
?????文件????????598??2009-05-17?20:54??1-ChatRoom\stdafx.cpp
?????文件???????3392??2009-06-18?12:48??1-ChatRoom\stdafx.h
?????文件??????21630??2003-04-01?04:36??1-ChatRoom\res\ChatRoom.ico
?????文件????????697??2006-03-20?21:33??1-ChatRoom\res\ChatRoom.manifest
?????文件????????364??2006-03-20?21:33??1-ChatRoom\res\ChatRoom.rc2
?????文件???????8809??2011-10-27?21:47??1-ChatRoom\1-ChatRoom.vcproj
?????文件???????1411??2011-10-27?22:04??1-ChatRoom\1-ChatRoom.vcproj.FRANKIE.Administrator.user
?????文件???????1060??2011-10-27?21:57??1-ChatRoom\ChatRoomDlg.h
?????文件???????5846??2011-10-27?22:01??1-ChatRoom\ChatRoomDlg.cpp
?????文件???????4738??2009-06-23?20:06??2-ChatClient\2-ChatClient.dsp
?????文件??????42896??2009-06-23?20:08??2-ChatClient\ChatClient.aps
?????文件???????1627??2009-06-18?13:38??2-ChatClient\ChatClient.clw
?????文件???????2065??2009-05-18?10:59??2-ChatClient\ChatClient.cpp
?????文件????????459??2009-05-17?13:04??2-ChatClient\ChatClient.h
............此處省略31個文件信息
評論
共有 條評論