资源简介
该聊天室是基于TCP。程序分为两个部分,客户端和服务器端,利用Socket(套接字)编程,实现了多个客户端之间的简单通信。该程序是学习网络编程的最佳选择,它能帮助你迅速的掌握网络编程的思路。

代码片段和文件信息
// ChatRoom_TCP_Client.cpp : 定义应用程序的类行为。
//
#include “stdafx.h“
#include “ChatRoom_TCP_Client.h“
#include “ChatRoom_TCP_ClientDlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CChatRoom_TCP_ClientApp
BEGIN_MESSAGE_MAP(CChatRoom_TCP_ClientApp CWinApp)
ON_COMMAND(ID_HELP &CWinApp::onhelp)
END_MESSAGE_MAP()
// CChatRoom_TCP_ClientApp 构造
CChatRoom_TCP_ClientApp::CChatRoom_TCP_ClientApp()
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CChatRoom_TCP_ClientApp 对象
CChatRoom_TCP_ClientApp theApp;
// CChatRoom_TCP_ClientApp 初始化
BOOL CChatRoom_TCP_ClientApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 创建 shell 管理器,以防对话框包含
// 任何 shell 树视图控件或 shell 列表视图控件。
CShellManager *pShellManager = new CShellManager;
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T(“应用程序向导生成的本地应用程序“));
CChatRoom_TCP_ClientDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置处理何时用
// “确定”来关闭对话框的代码
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
// “取消”来关闭对话框的代码
}
// 删除上面创建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 106868 2013-07-03 10:47 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.aps
文件 2256 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.cpp
文件 520 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.h
文件 11932 2013-07-03 10:47 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.rc
文件 6117 2013-07-03 09:08 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.vcxproj
文件 2262 2013-07-03 09:08 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.vcxproj.filters
文件 143 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_Client.vcxproj.user
文件 7298 2013-07-03 15:47 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_ClientDlg.cpp
文件 1042 2013-07-03 10:22 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ChatRoom_TCP_ClientDlg.h
文件 543 2013-07-03 15:38 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ClientSocket.cpp
文件 353 2013-07-03 13:37 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ClientSocket.h
文件 3300 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\ReadMe.txt
文件 67777 2009-08-31 02:31 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\res\ChatRoom_TCP_Client.ico
文件 694 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\res\ChatRoom_TCP_Client.rc2
文件 2302 2013-07-03 10:47 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\resource.h
文件 152 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\stdafx.cpp
文件 1683 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\stdafx.h
文件 234 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client\targetver.h
文件 924 2013-07-03 09:01 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client.sln
..A..H. 17408 2013-07-03 16:29 TCP_Chat\ChatRoom_TCP_Client\ChatRoom_TCP_Client.suo
文件 106768 2013-07-03 14:13 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.aps
文件 2256 2013-07-02 10:21 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.cpp
文件 520 2013-07-02 10:21 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.h
文件 11844 2013-07-03 14:13 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.rc
文件 6299 2013-07-02 16:38 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.vcxproj
文件 2644 2013-07-02 16:38 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.vcxproj.filters
文件 143 2013-07-02 10:20 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_Server.vcxproj.user
文件 6395 2013-07-03 15:00 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_ServerDlg.cpp
文件 1158 2013-07-02 20:56 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ChatRoom_TCP_ServerDlg.h
文件 0 2013-07-02 10:52 TCP_Chat\ChatRoom_TCP_Server\ChatRoom_TCP_Server\ClistenSocket.cpp
............此处省略36个文件信息
- 上一篇:net读取表格word
- 下一篇:博图v13授权文件
相关资源
- 智能客户端技术应用于课件开发的探
- TCP IP通信labview程序
- Modbus协议官方文档中、英文全
- FTP课程设计(服务端+客户端)
- Omron ETN21模块进行modbustcp通讯
- 通信软件的具体实例──基于Socket的
- 编写简单的RMI程序 多线程web 服务器
- 用VC 编写的仿QQ聊天室程序源代码
- IOCP 类 简单的IOCP(IO完成端口)服务
- 组态王中S7-300TCP驱动
- 基于Apache Mina实现的TCP长连接和短连接
- CVI下的TCP服务器和客户端
- 代码客:G-TcpServer(IOCP) 1.0 正式版及
- TCP 发包工具(windows)
- SOCKET 网络编程 计算机网络 作业 客户
- 用Socket写的简易FTP服务器和客户端
- 基于C 的简易FTP客户端(带源码)
- VxWorks TCPIP协议栈
- jar转exe工具 教程,exe能在客户端没有
- socket小工具(可方便建立TCP UDP的soc
- socket客户端源码
- vc 编写的基于TCP协议的客户/服务器
- 61850客户端服务端测试程序
- 基于CSocket的多人聊天室
- mfc聊天室
- irc聊天室
- 采用WINSOCK2 编写的TCP/UDP通信程序
- 简单服务器端口监听和显示客户端发
- Modbus TCP Client
- 易语言 TCP使用HTTP、SOCKES5代理IP。
评论
共有 条评论