資源簡介
開發環境:VC++6.0 基于對話框的MFC編程 ;功能:【一】,TCP Server;【二】,TCP Client;【三】,UDP三者合一;,TCP Server可以同時連接十個客戶端,并且可以同時給所連接的客戶端同時發送信息;,三者都可以循環發送信息,循環時間自己可以設定;,三者都可以使用外界數據源;,三者都可以將接收到的文本直接轉存到TXT文件里邊;,三者都有計數功能。 說明,本程序為個人興趣所寫,TCP Server,TCP Client,UDP,基本功能還是可以實現的,但是本程序還有許多不足之處,希望大家多多包容,多多批評指點(PS:切記請帶著審視的目光參考本程序,如果要把某項功能用到自己的項目里的話,請自行優化修改)

代碼片段和文件信息
//?Network.cpp?:?Defines?the?class?behaviors?for?the?application.
//
/*************************************************************/
/*2017-08-18安陽工學院計算機科學與工程學院502嵌入式系統實驗室*/
/*部分功能還需完善,部分注釋還未添加,本程序僅為個人興趣編寫?*/
/*若要參考,請帶著審視的態度,有不足之處還望包容 ?*/
/*************************************************************/
#include?“stdafx.h“
#include?“Network.h“
#include?“NetworkDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CNetworkApp
BEGIN_MESSAGE_MAP(CNetworkApp?CWinApp)
//{{AFX_MSG_MAP(CNetworkApp)
//?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()
/////////////////////////////////////////////////////////////////////////////
//?CNetworkApp?construction
CNetworkApp::CNetworkApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CNetworkApp?object
CNetworkApp?theApp;
CString?M_UDP_AimIP;
int?M_UDP_AimPort;
int?M_TCP_ClientPort;
/////////////////////////////////////////////////////////////////////////////
//?CNetworkApp?initialization
BOOL?CNetworkApp::InitInstance()
{
AfxEnableControlContainer();
if?(!AfxSocketInit())??
{??
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);?
return?FALSE;??
}?
//?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
SetRegistryKey(_T(“MyOneTest“));
CNetworkDlg?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;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-08-19?19:17??08.18-11.Network\
?????目錄???????????0??2017-08-19?19:17??08.18-11.Network\Debug\
?????文件????????5446??2017-08-19?19:17??08.18-11.Network\Debug\APPMODUL.obj
?????文件?????????574??2017-08-19?19:17??08.18-11.Network\Debug\APPMODUL.sbr
?????文件??????306372??2017-07-26?17:03??08.18-11.Network\Debug\BCMenu.obj
?????文件???????????0??2017-07-26?17:03??08.18-11.Network\Debug\BCMenu.sbr
?????文件???????33097??2017-07-26?17:03??08.18-11.Network\Debug\BkDialogST.obj
?????文件???????????0??2017-07-26?17:03??08.18-11.Network\Debug\BkDialogST.sbr
?????文件??????101448??2017-07-26?17:03??08.18-11.Network\Debug\BtnST.obj
?????文件???????????0??2017-07-26?17:03??08.18-11.Network\Debug\BtnST.sbr
?????文件???????19772??2017-07-26?19:28??08.18-11.Network\Debug\ImageButton.obj
?????文件???????????0??2017-07-26?19:28??08.18-11.Network\Debug\ImageButton.sbr
?????文件?????5317632??2017-08-04?19:33??08.18-11.Network\Debug\Network.bsc
?????文件??????151642??2017-08-19?19:17??08.18-11.Network\Debug\Network.exe
?????文件??????339620??2017-08-19?19:17??08.18-11.Network\Debug\Network.ilk
?????文件???????21913??2017-08-19?19:17??08.18-11.Network\Debug\Network.obj
?????文件?????7097260??2017-08-19?19:17??08.18-11.Network\Debug\Network.pch
?????文件??????369664??2017-08-19?19:17??08.18-11.Network\Debug\Network.pdb
?????文件????????5496??2017-08-19?19:17??08.18-11.Network\Debug\Network.res
?????文件????????7688??2017-08-19?19:17??08.18-11.Network\Debug\Network.sbr
?????文件??????147962??2017-08-19?19:17??08.18-11.Network\Debug\NetworkDlg.obj
?????文件???????29710??2017-08-19?19:17??08.18-11.Network\Debug\NetworkDlg.sbr
?????文件???????15000??2017-07-26?16:43??08.18-11.Network\Debug\RCa03972
?????文件??????111170??2017-08-19?19:17??08.18-11.Network\Debug\StdAfx.obj
?????文件?????1412752??2017-08-19?19:17??08.18-11.Network\Debug\StdAfx.sbr
?????文件???????14034??2017-08-19?19:17??08.18-11.Network\Debug\TCPClientDlg.obj
?????文件????????3714??2017-08-19?19:17??08.18-11.Network\Debug\TCPClientDlg.sbr
?????文件???????14780??2017-08-19?19:17??08.18-11.Network\Debug\UDPSet.obj
?????文件????????3857??2017-08-19?19:17??08.18-11.Network\Debug\UDPSet.sbr
?????文件??????214016??2017-08-19?19:17??08.18-11.Network\Debug\vc60.idb
?????文件??????372736??2017-08-19?19:17??08.18-11.Network\Debug\vc60.pdb
............此處省略27個文件信息
評論
共有 條評論