资源简介
自己写的 vs2010 + MFC + UDP socket 聊天程序。界面简洁,运行后只会产生一个exe,在局域网内输入对方ip即可发送信息。在同一台主机上也可以同时开两个instance。
代码片段和文件信息
#include “StdAfx.h“
#include “MySocket.h“
CMySocket::CMySocket(void)
{
pWnd = NULL;
}
CMySocket::~CMySocket(void)
{
}
void CMySocket::AttachCWnd(CWnd *pW)
{
pWnd = pW;
}
void CMySocket::OnSend(int nErrorCode)
{
if (pWnd)
pWnd->SendMessage(SOCKET_EVENT (WPARAM)this SEND);
CSocket::OnSend(nErrorCode);
}
void CMySocket::OnReceive(int nErrorCode)
{
if (pWnd)
pWnd->SendMessage(SOCKET_EVENT (WPARAM)this RETR);
// CSocket收到数据触发 OnReceive()函数
CSocket::OnReceive(nErrorCode);
}
void CMySocket::OnClose(int nErrorCode)
{
if (pWnd)
pWnd->SendMessage(SOCKET_EVENT (WPARAM)this CLOSE);
CSocket::OnClose(nErrorCode);
}
void CMySocket::OnAccept(int nErrorCode)
{
if (pWnd)
pWnd->SendMessage(SOCKET_EVENT (WPARAM)this ACCEPT);
CSocket::OnAccept(nErrorCode);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-12 18:38 姜勇_SimpleChat\
目录 0 2017-10-12 18:03 姜勇_SimpleChat\Debug\
文件 228352 2017-10-12 18:03 姜勇_SimpleChat\Debug\SimpleChatServer.exe
文件 1464248 2017-10-12 18:03 姜勇_SimpleChat\Debug\SimpleChatServer.ilk
文件 6392832 2017-10-12 18:03 姜勇_SimpleChat\Debug\SimpleChatServer.pdb
目录 0 2017-10-12 18:02 姜勇_SimpleChat\SimpleChat\
目录 0 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\
文件 724420 2017-10-12 17:53 姜勇_SimpleChat\SimpleChat\Debug\CL.read.1.tlog
文件 20148 2017-10-12 17:53 姜勇_SimpleChat\SimpleChat\Debug\CL.write.1.tlog
文件 13733 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\MySocket.obj
文件 68008 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\MySqlc.obj
文件 82 2017-09-28 16:24 姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.lastbuildstate
文件 1107 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.log
文件 28008 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.obj
文件 70016 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.res
文件 853 2017-10-10 15:04 姜勇_SimpleChat\SimpleChat\Debug\SimpleChat.vcxprojResolveAssemblyReference.cache
文件 275670 2017-10-12 17:53 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatDlg.obj
文件 11119 2017-09-29 13:25 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.Build.CppClean.log
文件 915 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.em
文件 980 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.em
文件 640 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.intermediate.manifest
文件 77 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.lastbuildstate
文件 39583744 2017-10-12 17:44 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.pch
文件 0 2017-09-29 13:26 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.write.1.tlog
文件 222 2017-09-29 13:28 姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer_manifest.rc
文件 24926 2017-10-12 17:53 姜勇_SimpleChat\SimpleChat\Debug\cl.command.1.tlog
文件 2 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\li
文件 2 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\li
文件 2 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\li
文件 2 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\li
文件 2 2017-10-12 18:03 姜勇_SimpleChat\SimpleChat\Debug\li
............此处省略162个文件信息
相关资源
- mfc Socket 网络调试助手
- VS MFC 聊天程序
- c++语言应用------基于visual studio的聊天
- C++写的telnet客户端,VS2010编译通过
- VS2017实现Tcp socket通信C++
- 基于winpcap网络协议编程
- 基于UDP的文件传输工程C++
- 用Socket写的HTTP类,商业级C++源码。
- socket 实现多人聊天
- Linux下局域网语音对讲
- tftp客户端和服务器
- vc++编写的聊天程序
- 原始套接字发送完整UDP数据包c语言实
- 数据链路层设计与实现
- win sockket全局代理驱动(c++ spi)
- udp 泛洪攻击vc++源码
- Linuxsocket文件传输C语言支持断点
- socket tcp通信 多客户端
- C语言基于socket多人聊天
- VC++ UDP穿透NATP2P原理及代码.rar
- C语言编写Socket编写进程间传文件
- 基于socket通信的,利用MFC实现TCP通信
- Linux环境下C语言Socket编程——客户端
- C语言socket编程实现网络数据传输
- websocket_server_client
- C语言socket/smtp发送邮件,支持附件,
- Windows下纯C语言Socket、smtp发送邮件,
- C Socket通信多线程数据双向收发VS201
- UDP实现广播通信 MFC
- 利用RawSocket实现简单的Ping程序 ICMP协
评论
共有 条评论