CSocketMaster

所属分类:网络编程
开发工具:Visual Basic
文件大小:61KB
下载次数:27
上传日期:2005-02-03 20:36:02
上 传 者211860
说明:  如果想了解Windows下面Socket通信的朋友可以下载一下,看看这个类是如何实现的。而且这个包里面还带了若干实现的范例。例如Socket聊天室等。推荐
(would like to know if the following Windows Socket Communications friends can download and see how this category is achievable. But inside the packet also brings the realization of a number of examples. For example, Socket chat rooms. Suggest)

文件列表:
CSocketMaster.cls (60278, 2004-02-29)
modSocketMaster.bas (34271, 2004-02-28)
Sample 1 - Simple TCP chat (0, 2004-03-01)
Sample 1 - Simple TCP chat\Client.frm (3308, 2004-02-27)
Sample 1 - Simple TCP chat\Server.frm (3384, 2004-02-27)
Sample 1 - Simple TCP chat\SimpleTCPChat.vbp (724, 2004-02-27)
Sample 2 - Simple UDP chat (0, 2004-03-01)
Sample 2 - Simple UDP chat\Client.frm (2596, 2004-02-27)
Sample 2 - Simple UDP chat\Server.frm (2364, 2004-02-27)
Sample 2 - Simple UDP chat\SimpleUDPChat.vbp (724, 2004-02-27)
Sample 3 - Winsock Control Clone (0, 2004-03-01)
Sample 3 - Winsock Control Clone\CSocketMaster.cls (60278, 2004-02-29)
Sample 3 - Winsock Control Clone\modSocketMaster.bas (34271, 2004-02-28)
Sample 3 - Winsock Control Clone\Socket.ctl (8120, 2004-02-23)
Sample 3 - Winsock Control Clone\Socket.ctx (3204, 2004-02-23)
Sample 3 - Winsock Control Clone\SocketMaster.bmp (2406, 2004-02-08)
Sample 3 - Winsock Control Clone\SocketMaster.exp (1023, 2004-02-29)
Sample 3 - Winsock Control Clone\SocketMaster.lib (2708, 2004-02-29)
Sample 3 - Winsock Control Clone\SocketMasterOCX.vbp (870, 2004-02-29)
Sample 3 - Winsock Control Clone\SocketMasterTB.bmp (822, 2002-05-29)
Sample 4 - CDownload (0, 2004-03-01)
Sample 4 - CDownload\CDownload.cls (10487, 2004-02-29)
Sample 4 - CDownload\Downloader.vbp (824, 2004-02-29)
Sample 4 - CDownload\frmDownloader.frm (5051, 2004-02-29)
Subclass.asm (6706, 2004-02-26)

CSocketMaster 1.1 readme file ============================= *** What is CSocketMaster? ========================== CSocketMaster class is a Winsock control substitute that attempts to mimic it's behavior and interface to make it easy to implement. *** How do you use it? ====================== 1) Add CSocketMaster.cls and modSocketMaster.bas to your project. 2) In a Form, Class or UserControl add this line in the declaration area for each socket you want to use: Dim WithEvents NameOfSocket As CSocketMaster where 'NameOfSocket' is any name you want for the socket. 3) Finally you need to create the object before using it. Add this line in a sub or funtion: Set NameOfSocket = New CSocketMaster That's it. *** Differences between CSocketMaster and Winsock control ========================================================= A) Winsock Close function is CloseSck in CSocketMaster. B) Winsock Close event is CloseSck in CSocketMaster. C) WndProc function is used to deliver system messages and you should not call it under any circumstance. D) There are some other differences I intentionally put in CSocketMaster that you shouldn't notice. If you find a major difference that you think shouldn't be there, please let me know. *** Known issues ================ A) Msgbox Due to a VB behavior by desing running a project in the IDE that displays a message box created with Msgbox prevents events from occurring. If you really need to use message boxes then you can use MessageBox api instead. Note that this only happens in the IDE, when you compile your project all events are fired no matter what. For more info check this site: http://support.microsoft.com/default.aspx?scid=kb;en-us;178078 *** Why not use Winsock control? ================================ Bacause winsock it's a fixed non-modifiable control. Also it is known that Winsock has a memory leak. *** Why use a class instead of a control? ========================================= Using a class instead of a control has some clear benefits. You have total encapsulation, and you could, for example, make a class (or control) that downloads files from internet just passing a URL without knowing how CSocketMaster works internally. You can modify CSocketMaster and add more fancy functions and events. Best of all: you don't have external dependencies. *** Why use a control instead of a class? ========================================= There's a Winsock control clone as part of the sample projects. With a control you can build arrays and create sockets at runtime easier. *** What tha' heck is that subclassing stuff? ============================================= When you work with winsock you need to subclass a window to receive system's info from the socket. If you are familiar with the concept of subclassing on VB you should know that if you subclass a window and press then End button while in IDE you get a nice GPF and your system crashes. To solve this I use a code based on Paul Caton's WinSubHook2 that can be found at www.planet-source-code.com. If you wanna understand how my subclassing code works you have to understand his first. The asm code for the WndProc is in Subclass.asm file. This subclassing approach is not fully tested yet, so let me know if you get a GPF. *** Why so many Debug logs? =========================== That's for helping me (and you) to find any possible bug. If you get annoyed you can always erase them or comment them. *** Bug report ============== If you have a question firs't check this site: http://www.geocities.com/anshoku/ I will post FAQs to this page so I don't have to answer a question twice. If you don't find your answer there you can send me an email, but first read this: A) If I consider that your question is answered on my page your email will be ignored. B) Make sure it's a bug! Maybe what you think it's a bug is normal winsock behavior. Use winsock control to check if the malfunction persists. C) I suppose you know how to work with winsock cause I will not teach you how to do it. So don't ask me something like 'how to make a connection?' or 'how can I make a chat prog?'. D) If you could send me some sample code to illustrate the bug, that would be great. E) Don't be a lamer, don't send spam or chain mails. Emiliano Scavuzzo Rosario, Argentina

近期下载者

相关文件


收藏者