资源简介
在VS2015下写的TCP文件传输,服务器先收到先收到客服端传来的文件名,及文件大小,然后再指定目录下建立相应的文件,然后接收文件!
代码片段和文件信息
// FileServer.cpp : Defines the class behaviors for the application.
//
#include “stdafx.h“
#include “FileServer.h“
#include “FileServerDlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CFileServerApp
BEGIN_MESSAGE_MAP(CFileServerApp CWinApp)
ON_COMMAND(ID_HELP &CWinApp::onhelp)
END_MESSAGE_MAP()
// CFileServerApp construction
CFileServerApp::CFileServerApp()
{
// support Restart Manager
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: add construction code here
// Place all significant initialization in InitInstance
}
// The one and only CFileServerApp object
CFileServerApp theApp;
// CFileServerApp initialization
BOOL CFileServerApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// Create the shell manager in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;
// Activate “Windows Native“ visual manager for enabling themes in MFC controls
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 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
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));
CFileServerDlg dlg;
m_pMainWnd = &dlg;
INT_PTR 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
}
else if (nResponse == -1)
{
TRACE(traceAppMsg 0 “Warning: dialog creation failed so application is terminating unexpectedly.\n“);
TRACE(traceAppMsg 0 “Warning: if you are using MFC controls on the dialog you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n“);
}
// Delete the shell manager created above.
if (pShellManager != NULL)
{
delete pShellManager;
}
#ifndef _AFXDLL
ControlBarCleanUp();
#endif
// Since the dialog has been closed return FALSE
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 34816 2018-01-04 18:48 FileServer\.vs\FileServer\v14\.suo
文件 219648 2018-01-04 18:12 FileServer\Debug\FileServer.exe
文件 1449852 2018-01-04 18:12 FileServer\Debug\FileServer.ilk
文件 7360512 2018-01-04 18:12 FileServer\Debug\FileServer.pdb
文件 1220 2018-01-04 11:13 FileServer\FileServer\Debug\FileServer.Build.CppClean.log
文件 193 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.log
文件 70232 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.obj
文件 58458112 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.pch
文件 69940 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.res
文件 4986 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\CL.command.1.tlog
文件 165310 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\CL.read.1.tlog
文件 3986 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\CL.write.1.tlog
文件 199 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\FileServer.lastbuildstate
文件 3214 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\li
文件 12158 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\li
文件 1594 2018-01-04 18:12 FileServer\FileServer\Debug\FileServer.tlog\li
文件 846 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.tlog\rc.command.1.tlog
文件 5998 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.tlog\rc.read.1.tlog
文件 474 2018-01-04 18:09 FileServer\FileServer\Debug\FileServer.tlog\rc.write.1.tlog
文件 68261 2018-01-04 18:12 FileServer\FileServer\Debug\FileServerDlg.obj
文件 926258 2018-01-04 18:09 FileServer\FileServer\Debug\stdafx.obj
文件 2427904 2018-01-04 18:12 FileServer\FileServer\Debug\vc140.idb
文件 6795264 2018-01-04 18:12 FileServer\FileServer\Debug\vc140.pdb
文件 91784 2018-01-03 22:28 FileServer\FileServer\FileServer.aps
文件 3111 2018-01-03 22:33 FileServer\FileServer\FileServer.cpp
文件 529 2018-01-03 20:54 FileServer\FileServer\FileServer.h
文件 12266 2018-01-03 21:12 FileServer\FileServer\FileServer.rc
文件 10803 2018-01-03 21:13 FileServer\FileServer\FileServer.vcxproj
文件 2114 2018-01-03 20:54 FileServer\FileServer\FileServer.vcxproj.filters
文件 6788 2018-01-04 18:12 FileServer\FileServer\FileServerDlg.cpp
............此处省略27个文件信息
评论
共有 条评论