?? testclient.cpp
字號:
// TestClient.cpp: implementation of the CTestClient class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SyncClient.h"
#include "TestClient.h"
#include "iostream"
using namespace std;
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTestClient::CTestClient(SOCKET s, const char* pszPeerAddr, unsigned short nPeerPort, BOOL bCloseWait /* = TRUE */ )
: CSyncSocketWorker<CTestClient>(s, pszPeerAddr, nPeerPort, bCloseWait)
{
}
CTestClient::~CTestClient()
{
}
extern CRITICAL_SECTION g_cs;
void CTestClient::ProcessData()
{
const int nBufferSize = 8192;
char szBuffer[nBufferSize];
CFile file;
file.Open(TEXT("recv.jpg"), CFile::modeCreate | CFile::modeWrite);
int nRead;
DWORD dwStart = GetTickCount();
while(nRead = Read(szBuffer, nBufferSize))
{
file.Write(szBuffer, nRead);
if(IsShutingdown())
{
cout << "shuting down" << endl;
break;
}
}
cout << "Speed = " << double(file.GetLength()) / (double(GetTickCount() - dwStart) / 1000.0) / 1024 << "KB/s" << endl;
file.Close();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -