全文预览

TCP课设报告

上传者:相惜 |  格式:doc  |  页数:23 |  大小:264KB

文档介绍
Socket的定义和实现Р头文件ListenSocket.h, 定义类CSocket的派生类CListenSocket。Р hatServerDoc;РlientSocket : public CSocketР{Рpublic:РCSocketFile* m_pFile;РCArchive* m_pArchiveIn;РCArchive* m_pArchiveOut;РCChatServerDoc* m_pDoc;Рpublic:Р?CClientSocket();Р?virtual ~CClientSocket();Р?void WorkWithArchive();Рpublic:Р?public:Р?virtual void OnReceive(int nErrorCode);Р?virtual void OnClose(int nErrorCode);Рprotected:Р};Р#endif РListenSocket.cpp,CListenSocket 的实现部分,主要用来监控这些连接的状态,在客户主动离开或发生故障时从列表中删除相应表项。Р#include "stdafx.h"Р#include "ChatServer.h"Р#include "ChatServerdoc.h"Р#include "ClientSocket.h"Р#ifdef _DEBUGР#define new DEBUG_NEWР#undef THIS_FILEРstatic char THIS_FILE[] = __FILE__;Р#endifРCClientSocket::CClientSocket()Р{Р?m_pArchiveOut=NULL;Р?m_pArchiveIn=NULL;Р?m_pFile=NULL;Р}РCClientSocket::~CClientSocket()Р{

收藏

分享

举报
下载此文档