資源簡(jiǎn)介
socket編程,基于UDP的簡(jiǎn)單可視化界面聊天程序,,局域網(wǎng)內(nèi)可用,剛開始學(xué)socket編程的娃兒可以看一下,共勉。

代碼片段和文件信息
//?Chat.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“Chat.h“
#include?“ChatDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CChatApp
BEGIN_MESSAGE_MAP(CChatApp?CWinApp)
//{{AFX_MSG_MAP(CChatApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CChatApp?construction
CChatApp::CChatApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CChatApp?object
CChatApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CChatApp?initialization
//判斷加載套接字庫是否成功,注意要在StdAfx.h預(yù)編譯同文件中加入#include?這個(gè)頭文件
BOOL?CChatApp::InitInstance()
{
if(!AfxSocketInit())
{
AfxMessageBox(“加載套接字庫失敗!“);
return?FALSE;
}
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CChatDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????35772??2013-04-26?20:19??Chat\Chat.aps
?????文件???????1196??2013-04-26?20:27??Chat\Chat.clw
?????文件???????2217??2013-04-25?11:29??Chat\Chat.cpp
?????文件???????4123??2013-04-25?10:53??Chat\Chat.dsp
?????文件????????533??2013-04-25?10:53??Chat\Chat.dsw
?????文件???????1302??2013-04-25?10:53??Chat\Chat.h
?????文件??????74752??2013-04-26?20:27??Chat\Chat.ncb
?????文件??????50688??2013-04-26?20:27??Chat\Chat.opt
?????文件????????667??2013-04-26?20:19??Chat\Chat.plg
?????文件???????5519??2013-04-26?20:19??Chat\Chat.rc
?????文件???????6783??2013-04-25?16:43??Chat\ChatDlg.cpp
?????文件???????1649??2013-04-25?13:29??Chat\ChatDlg.h
?????文件?????106563??2013-04-26?20:19??Chat\Debug\Chat.exe
?????文件?????208968??2013-04-26?20:19??Chat\Debug\Chat.ilk
?????文件??????13070??2013-04-25?13:45??Chat\Debug\Chat.obj
?????文件????5566904??2013-04-25?13:21??Chat\Debug\Chat.pch
?????文件?????386048??2013-04-26?20:19??Chat\Debug\Chat.pdb
?????文件???????2628??2013-04-26?20:19??Chat\Debug\Chat.res
?????文件??????30369??2013-04-25?16:43??Chat\Debug\ChatDlg.obj
?????文件?????106332??2013-04-25?13:21??Chat\Debug\StdAfx.obj
?????文件?????214016??2013-04-26?20:19??Chat\Debug\vc60.idb
?????文件?????364544??2013-04-25?16:43??Chat\Debug\vc60.pdb
?????文件???????3543??2013-04-25?10:53??Chat\ReadMe.txt
?????文件???????1078??2013-04-25?10:53??Chat\res\Chat.ico
?????文件????????396??2013-04-25?10:53??Chat\res\Chat.rc2
?????文件????????820??2013-04-25?13:45??Chat\resource.h
?????文件????????206??2013-04-25?10:53??Chat\StdAfx.cpp
?????文件???????1073??2013-04-25?11:29??Chat\StdAfx.h
?????目錄??????????0??2013-04-26?20:19??Chat\Debug
?????目錄??????????0??2013-04-25?23:55??Chat\res
............此處省略4個(gè)文件信息
評(píng)論
共有 條評(píng)論