实例介绍
*** v3.1.1 更新 *** > 增加导出纯 C 函数的动态链接库 HPSocket4C.dll: ----------------- 1.增加代码文件 HPSocket4C.h 和 HPSocket4C.cpp,用于创建 HPSocket4C.dll 2.导出纯 C 函数,让其它语言(如:C/C#/Delphi 等)能方便地使用 HPSocket 3.HPSocket4C.dll 使用方法 方法一: ------------------------------------------------------------------------------ (0) (C/C++ 程序)包含 HPSocket4C.h 头文件 (1) 调用 ::Create_HP_XxxListener() 函数创建监听器对象 (2) 调用 ::Create_HP_Xxx(pListener) 函数创建 HPSocket 对象 (3) 调用 ::HP_Set_FN_Xxx_OnYyy(pListener, ...) 函数设置监听器的回调函数 (4) 调用相关导出函数操作 HPSocket 对象 (5) ...... ...... (6) 调用 ::Destroy_HP_Xxx(pSocket) 函数销毁 HPSocket 对象 (7) 调用 ::Destroy_HP_XxxListener(pListener) 函数销毁监听器对象 方法二: ------------------------------------------------------------------------------ (1) 应用程序把需要用到的导出函数封装到特定语言的包装类中 (2) 通过包装类封装后,以面向对象的方式使用 HPSocket 4.动态链接库发行版本 (1) x86/HPSocket4C.dll - (32位/MBCS/Release) (2) x86/HPSocket4C_D.dll - (32位/MBCS/DeBug) (3) x86/HPSocket4C_U.dll - (32位/UNICODE/Release) (4) x86/HPSocket4C_UD.dll - (32位/UNICODE/DeBug) (5) x64/HPSocket4C.dll - (64位/MBCS/Release) (6) x64/HPSocket4C_D.dll - (64位/MBCS/DeBug) (7) x64/HPSocket4C_U.dll - (64位/UNICODE/Release) (8) x64/HPSocket4C_UD.dll - (64位/UNICODE/DeBug) > 全面启用 Buffer Pool 缓存机制:
【实例截图】
【核心代码】
4744300845382420093.zip
└── hp-socket-3.1.1
├── Bin
│ ├── HPSocket
│ │ ├── HPSocket.h
│ │ ├── SocketInterface.h
│ │ ├── x64
│ │ │ ├── HPSocket_D.dll
│ │ │ ├── HPSocket_D.lib
│ │ │ ├── HPSocket.dll
│ │ │ ├── HPSocket.lib
│ │ │ ├── HPSocket_UD.dll
│ │ │ ├── HPSocket_UD.lib
│ │ │ ├── HPSocket_U.dll
│ │ │ └── HPSocket_U.lib
│ │ └── x86
│ │ ├── HPSocket_D.dll
│ │ ├── HPSocket_D.lib
│ │ ├── HPSocket.dll
│ │ ├── HPSocket.lib
│ │ ├── HPSocket_UD.dll
│ │ ├── HPSocket_UD.lib
│ │ ├── HPSocket_U.dll
│ │ └── HPSocket_U.lib
│ └── HPSocket4C
│ ├── HPSocket4C.h
│ ├── x64
│ │ ├── HPSocket4C_D.dll
│ │ ├── HPSocket4C_D.lib
│ │ ├── HPSocket4C.dll
│ │ ├── HPSocket4C.lib
│ │ ├── HPSocket4C_UD.dll
│ │ ├── HPSocket4C_UD.lib
│ │ ├── HPSocket4C_U.dll
│ │ └── HPSocket4C_U.lib
│ └── x86
│ ├── HPSocket4C_D.dll
│ ├── HPSocket4C_D.lib
│ ├── HPSocket4C.dll
│ ├── HPSocket4C.lib
│ ├── HPSocket4C_UD.dll
│ ├── HPSocket4C_UD.lib
│ ├── HPSocket4C_U.dll
│ └── HPSocket4C_U.lib
├── ChangeLog.txt
├── Common
│ ├── ChangeLog.txt
│ ├── License.txt
│ └── Src
│ ├── bufferpool.cpp
│ ├── bufferpool.h
│ ├── bufferptr.cpp
│ ├── bufferptr.h
│ ├── CriticalSection.cpp
│ ├── CriticalSection.h
│ ├── debug
│ │ ├── win32_crtdbg.cpp
│ │ └── win32_crtdbg.h
│ ├── Event.cpp
│ ├── Event.h
│ ├── FuncHelper.cpp
│ ├── FuncHelper.h
│ ├── GeneralHelper.cpp
│ ├── GeneralHelper.h
│ ├── PrivateHeap.cpp
│ ├── PrivateHeap.h
│ ├── RWLock.cpp
│ ├── RWLock.h
│ ├── SE.h
│ ├── Semaphore.cpp
│ ├── Semaphore.h
│ ├── Singleton.h
│ ├── socket
│ │ ├── HPSocket4C.cpp
│ │ ├── HPSocket4C.h
│ │ ├── HPSocket.cpp
│ │ ├── HPSocket.h
│ │ ├── SocketHelper.cpp
│ │ ├── SocketHelper.h
│ │ ├── SocketInterface.h
│ │ ├── TcpClient.cpp
│ │ ├── TcpClient.h
│ │ ├── TcpPullClient.cpp
│ │ ├── TcpPullClient.h
│ │ ├── TcpPullServer.cpp
│ │ ├── TcpPullServer.h
│ │ ├── TcpServer.cpp
│ │ ├── TcpServer.h
│ │ ├── UdpClient.cpp
│ │ ├── UdpClient.h
│ │ ├── UdpServer.cpp
│ │ └── UdpServer.h
│ ├── STLHelper.h
│ ├── WaitFor.cpp
│ ├── WaitFor.h
│ └── Win32Helper.h
├── License.txt
├── Readme.txt
└── TestSocket
├── Global
│ ├── helper.cpp
│ └── helper.h
├── HPSocketDLL
│ ├── dllmain.cpp
│ ├── HPSocketDLL.cpp
│ ├── HPSocketDLL.rc
│ ├── HPSocketDLL.sln
│ ├── HPSocketDLL.vcxproj
│ ├── HPSocketDLL.vcxproj.filters
│ ├── HPSocketDLL.vcxproj.user
│ ├── ReadMe.txt
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── HPSocketDLL4C
│ ├── dllmain.cpp
│ ├── HPSocketDLL4C.sln
│ ├── HPSocketDLL.cpp
│ ├── HPSocketDLL.rc
│ ├── HPSocketDLL.vcxproj
│ ├── HPSocketDLL.vcxproj.filters
│ ├── HPSocketDLL.vcxproj.user
│ ├── ReadMe.txt
│ ├── resource.h
│ ├── stdafx.cpp
│ └── stdafx.h
├── TestEcho
│ ├── Client
│ │ ├── Client.cpp
│ │ ├── ClientDlg.cpp
│ │ ├── ClientDlg.h
│ │ ├── Client.h
│ │ ├── Client.rc
│ │ ├── Client.vcxproj
│ │ ├── Client.vcxproj.filters
│ │ ├── Client.vcxproj.user
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Client.ico
│ │ │ └── Client.rc2
│ │ ├── resource.h
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── Release
│ │ ├── Client.exe
│ │ └── Server.exe
│ ├── Server
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Server.ico
│ │ │ └── Server.rc2
│ │ ├── resource.h
│ │ ├── Server.cpp
│ │ ├── ServerDlg.cpp
│ │ ├── ServerDlg.h
│ │ ├── Server.h
│ │ ├── Server.rc
│ │ ├── Server.vcxproj
│ │ ├── Server.vcxproj.filters
│ │ ├── Server.vcxproj.user
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── TestEcho.sln
│ └── x64
│ └── Release
│ ├── Client.exe
│ └── Server.exe
├── TestEcho-4C
│ ├── Client
│ │ ├── Client.cpp
│ │ ├── ClientDlg.cpp
│ │ ├── ClientDlg.h
│ │ ├── Client.h
│ │ ├── Client.rc
│ │ ├── Client.vcxproj
│ │ ├── Client.vcxproj.filters
│ │ ├── Client.vcxproj.user
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Client.ico
│ │ │ └── Client.rc2
│ │ ├── resource.h
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── Release
│ │ ├── Client.exe
│ │ ├── HPSocket4C_U.dll
│ │ └── Server.exe
│ ├── Server
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Server.ico
│ │ │ └── Server.rc2
│ │ ├── resource.h
│ │ ├── Server.cpp
│ │ ├── ServerDlg.cpp
│ │ ├── ServerDlg.h
│ │ ├── Server.h
│ │ ├── Server.rc
│ │ ├── Server.vcxproj
│ │ ├── Server.vcxproj.filters
│ │ ├── Server.vcxproj.user
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── TestEcho-4C.sln
│ └── x64
│ └── Release
│ ├── Client.exe
│ ├── HPSocket4C_U.dll
│ └── Server.exe
├── TestEcho-PFM
│ ├── Client
│ │ ├── Client.cpp
│ │ ├── ClientDlg.cpp
│ │ ├── ClientDlg.h
│ │ ├── Client.h
│ │ ├── Client.rc
│ │ ├── Client.vcxproj
│ │ ├── Client.vcxproj.filters
│ │ ├── Client.vcxproj.user
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Client.ico
│ │ │ └── Client.rc2
│ │ ├── resource.h
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── Release
│ │ ├── Client.exe
│ │ ├── HPSocket_U.dll
│ │ └── Server.exe
│ ├── Server
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Server.ico
│ │ │ └── Server.rc2
│ │ ├── resource.h
│ │ ├── Server.cpp
│ │ ├── ServerDlg.cpp
│ │ ├── ServerDlg.h
│ │ ├── Server.h
│ │ ├── Server.rc
│ │ ├── Server.vcxproj
│ │ ├── Server.vcxproj.filters
│ │ ├── Server.vcxproj.user
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── TestEcho-PFM.sln
│ └── x64
│ └── Release
│ ├── Client.exe
│ ├── HPSocket_U.dll
│ └── Server.exe
├── TestEcho-Pull
│ ├── Client
│ │ ├── Client.cpp
│ │ ├── ClientDlg.cpp
│ │ ├── ClientDlg.h
│ │ ├── Client.h
│ │ ├── Client.rc
│ │ ├── Client.vcxproj
│ │ ├── Client.vcxproj.filters
│ │ ├── Client.vcxproj.user
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Client.ico
│ │ │ └── Client.rc2
│ │ ├── resource.h
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── Release
│ │ ├── Client.exe
│ │ ├── HPSocket_U.dll
│ │ └── Server.exe
│ ├── Server
│ │ ├── ReadMe.txt
│ │ ├── res
│ │ │ ├── Server.ico
│ │ │ └── Server.rc2
│ │ ├── resource.h
│ │ ├── Server.cpp
│ │ ├── ServerDlg.cpp
│ │ ├── ServerDlg.h
│ │ ├── Server.h
│ │ ├── Server.rc
│ │ ├── Server.vcxproj
│ │ ├── Server.vcxproj.filters
│ │ ├── Server.vcxproj.user
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ └── targetver.h
│ ├── TestEcho-Pull.sln
│ └── x64
│ └── Release
│ ├── Client.exe
│ ├── HPSocket_U.dll
│ └── Server.exe
└── TestEcho-UDP
├── Client
│ ├── Client.cpp
│ ├── ClientDlg.cpp
│ ├── ClientDlg.h
│ ├── Client.h
│ ├── Client.rc
│ ├── Client.vcxproj
│ ├── Client.vcxproj.filters
│ ├── Client.vcxproj.user
│ ├── ReadMe.txt
│ ├── res
│ │ ├── Client.ico
│ │ └── Client.rc2
│ ├── resource.h
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── Release
│ ├── Client.exe
│ └── Server.exe
├── Server
│ ├── ReadMe.txt
│ ├── res
│ │ ├── Server.ico
│ │ └── Server.rc2
│ ├── resource.h
│ ├── Server.cpp
│ ├── ServerDlg.cpp
│ ├── ServerDlg.h
│ ├── Server.h
│ ├── Server.rc
│ ├── Server.vcxproj
│ ├── Server.vcxproj.filters
│ ├── Server.vcxproj.user
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── TestEcho-UDP.sln
└── x64
└── Release
├── Client.exe
└── Server.exe
56 directories, 290 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论