• 大小: 2.2MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-09-04
  • 语言: C/C++
  • 标签:

资源简介

单界面,在界面内可以选择是服务端还是客户端,先运行服务端,点击监听按钮,与客户端连接成功后可以通信。未使用到多线程技术,代码段都有注释,适合初学者。

资源截图

代码片段和文件信息

// MySock.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “MySock.h“
#include “MySockDlg.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMySockApp

BEGIN_MESSAGE_MAP(CMySockApp CWinApp)
//{{AFX_MSG_MAP(CMySockApp)
// 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()

/////////////////////////////////////////////////////////////////////////////
// CMySockApp construction

CMySockApp::CMySockApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMySockApp object

CMySockApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CMySockApp initialization

BOOL CMySockApp::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

CMySockDlg 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  2015-04-26 14:59  MySock\
     目录           0  2015-04-26 14:59  MySock\Debug\
     文件      114731  2015-04-26 14:59  MySock\Debug\MySock.exe
     文件      230340  2015-04-26 14:59  MySock\Debug\MySock.ilk
     文件       15547  2015-04-26 14:35  MySock\Debug\MySock.obj
     文件     5563788  2015-04-26 12:56  MySock\Debug\MySock.pch
     文件      369664  2015-04-26 14:59  MySock\Debug\MySock.pdb
     文件        3100  2015-04-26 14:59  MySock\Debug\MySock.res
     文件       39394  2015-04-26 14:35  MySock\Debug\MySockDlg.obj
     文件        6101  2015-04-26 14:35  MySock\Debug\MySocket.obj
     文件      106366  2015-04-26 12:56  MySock\Debug\StdAfx.obj
     文件      214016  2015-04-26 14:59  MySock\Debug\vc60.idb
     文件      372736  2015-04-26 14:35  MySock\Debug\vc60.pdb
     文件       36392  2015-04-26 14:59  MySock\MySock.aps
     文件        1849  2015-04-26 14:59  MySock\MySock.clw
     文件        2157  2015-04-26 12:42  MySock\MySock.cpp
     文件        4287  2015-04-26 14:36  MySock\MySock.dsp
     文件         518  2015-04-26 12:42  MySock\MySock.dsw
     文件        1324  2015-04-26 12:42  MySock\MySock.h
     文件       50176  2015-04-26 14:59  MySock\MySock.ncb
     文件       48640  2015-04-26 14:59  MySock\MySock.opt
     文件         680  2015-04-26 14:59  MySock\MySock.plg
     文件        6372  2015-04-26 14:59  MySock\MySock.rc
     文件        8142  2015-04-26 13:25  MySock\MySockDlg.cpp
     文件        1724  2015-04-26 13:22  MySock\MySockDlg.h
     文件        2037  2015-04-26 14:35  MySock\MySocket.cpp
     文件        1866  2015-04-26 14:35  MySock\MySocket.h
     文件        3579  2015-04-26 12:42  MySock\ReadMe.txt
     文件         208  2015-04-26 12:42  MySock\StdAfx.cpp
     文件        1102  2015-04-26 12:42  MySock\StdAfx.h
     目录           0  2015-04-26 12:42  MySock\res\
............此处省略3个文件信息

评论

共有 条评论