• 大小: 54.48MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-11-03
  • 语言: C/C++
  • 标签: UDP  socket  聊天程序  

资源简介

自己写的 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.embed.manifest
     文件         980  2017-10-12 17:44  姜勇_SimpleChat\SimpleChat\Debug\SimpleChatServer.exe.embed.manifest.res
     文件         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\link-cvtres.read.1.tlog
     文件           2  2017-10-12 18:03  姜勇_SimpleChat\SimpleChat\Debug\link-cvtres.write.1.tlog
     文件           2  2017-10-12 18:03  姜勇_SimpleChat\SimpleChat\Debug\link.2308-cvtres.read.1.tlog
     文件           2  2017-10-12 18:03  姜勇_SimpleChat\SimpleChat\Debug\link.2308-cvtres.write.1.tlog
     文件           2  2017-10-12 18:03  姜勇_SimpleChat\SimpleChat\Debug\link.2308.read.1.tlog
............此处省略162个文件信息

评论

共有 条评论