资源简介
用CSocket实现的一个服务端和客户端,服务端启动后可以启动监听,等待客户端连接。当客户端发来消息时,自动回发一个消息。客户端发"close"可以使服务端停止监听,发"quit"可以使服务端delete监听线程,这样服务端点击“启动监听”按钮时,会重新创建监听线程并监听。
代码片段和文件信息
// ClientApp.cpp : Defines the class behaviors for the application.
//
#include “stdafx.h“
#include “ClientApp.h“
#include “ClientAppDlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CClientAppApp
BEGIN_MESSAGE_MAP(CClientAppApp CWinApp)
//{{AFX_MSG_MAP(CClientAppApp)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CClientAppApp construction
CClientAppApp::CClientAppApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CClientAppApp object
CClientAppApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CClientAppApp initialization
BOOL CClientAppApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
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
CClientAppDlg 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;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 20996 2011-01-24 09:00 ClientApp\ClientApp.aps
文件 1167 2011-02-22 10:08 ClientApp\ClientApp.clw
文件 2199 2010-05-21 16:52 ClientApp\ClientApp.cpp
文件 4214 2011-01-24 00:46 ClientApp\ClientApp.dsp
文件 543 2011-01-23 17:04 ClientApp\ClientApp.dsw
文件 1357 2010-05-21 16:52 ClientApp\ClientApp.h
文件 107520 2011-02-22 18:01 ClientApp\ClientApp.ncb
文件 53760 2011-02-22 18:01 ClientApp\ClientApp.opt
文件 994 2011-02-22 08:54 ClientApp\ClientApp.plg
文件 5363 2011-01-23 18:15 ClientApp\ClientApp.rc
文件 4813 2011-02-22 08:53 ClientApp\ClientAppDlg.cpp
文件 1423 2011-01-23 18:15 ClientApp\ClientAppDlg.h
文件 3695616 2011-01-23 23:21 ClientApp\Debug\ClientApp.bsc
文件 106572 2011-02-22 08:54 ClientApp\Debug\ClientApp.exe
文件 200220 2011-02-22 08:54 ClientApp\Debug\ClientApp.ilk
文件 14463 2011-02-22 08:48 ClientApp\Debug\ClientApp.obj
文件 6948948 2011-02-22 08:48 ClientApp\Debug\ClientApp.pch
文件 377856 2011-02-22 08:54 ClientApp\Debug\ClientApp.pdb
文件 2588 2011-02-22 08:48 ClientApp\Debug\ClientApp.res
文件 2600 2011-02-22 08:48 ClientApp\Debug\ClientApp.sbr
文件 28524 2011-02-22 08:54 ClientApp\Debug\ClientAppDlg.obj
文件 4855 2011-02-22 08:54 ClientApp\Debug\ClientAppDlg.sbr
文件 106651 2011-02-22 08:48 ClientApp\Debug\StdAfx.obj
文件 1391428 2011-02-22 08:48 ClientApp\Debug\StdAfx.sbr
文件 205824 2011-02-22 08:54 ClientApp\Debug\vc60.idb
文件 364544 2011-02-22 08:54 ClientApp\Debug\vc60.pdb
文件 258 2011-02-22 10:11 ClientApp\ReadMe.txt
文件 1078 2010-05-21 16:52 ClientApp\res\ClientApp.ico
文件 401 2010-05-21 16:52 ClientApp\res\ClientApp.rc2
文件 870 2011-01-23 18:15 ClientApp\Resource.h
............此处省略56个文件信息
- 上一篇:先进PID控制MATLAB仿真
- 下一篇:算法精解:C语言描述(含源代码)
评论
共有 条评论