NewSockOCX

所属分类:网络编程
开发工具:Visual Basic
文件大小:33KB
下载次数:8
上传日期:2016-12-07 10:05:36
上 传 者loquat
说明:  国外大神的另一个winsock.ocx的替代品 也是纯API编写,同样既可以编译成ocx使用,也可以直接作为类使用 特点是支持IPv6,其他优势待发现
(Another great God winsock.ocx foreign alternatives is pure API written in the same either compiled ocx used either directly as such use feature is support for IPv6, other advantages to be discovered)

文件列表:
mWinSock.bas (41773, 2016-02-16)
NewSocket.bmp (2406, 2004-02-08)
NewSocket.cls (52665, 2016-02-16)
NewSocketOCX.vbp (1051, 2016-03-31)
NewSocketOCX.vbw (115, 2016-03-31)
NewSocketTB.bmp (822, 2002-05-29)
ocxTest.frm (783, 2016-03-31)
ocxTest.vbp (743, 2016-03-31)
ocxTest.vbw (51, 2016-03-31)
Socket.ctl (7210, 2016-03-31)
Socket.ctx (3204, 2016-03-31)
WebTest1.frm (5308, 2016-03-31)
WebTest1.vbp (686, 2016-03-31)
WebTest1.vbw (114, 2016-03-31)
WebTest2.frm (4679, 2016-03-31)
WebTest2.vbp (691, 2016-03-31)
WebTest2.vbw (50, 2016-03-31)

The Winsock Control from Microsoft is not the easiest thing in the world to work with, but it is a lot easier than working directly with the Winsock API. Unfortunately, the Winsock Control does not support IPv6, and it doesn’t look like it ever will. So what are the alternatives for VB programmers who do not want to get involved with C++ orC#. "Csocket" by Oleg Gdalevich is a drop-in replacement for the Winsock Control. It was further enhanced by Emiliano Scavuzzo with his "CsocketMaster" class. There are a number of advantages with using a Class Module instead of a Control, not the least of which is that it can be modified to suit special needs. These 2 authors took a different approach, but both use "callbacks". VB6 does not do threading very well, so callbacks are the only real way of communicating with the Windows messaging system. The use of callbacks instead of threads is sometimes referred to as Non-Blocking calls versus Blocking calls. CSocket2 was essentially CsocketMaster modified to use IP Version independent system calls. Many of the functions were found to be unused and therefore redundant. Of particular note was the ability to Send & Receive any type of variable by using Variants. NewSocket 2.5 sends and accepts strings or byte arrays. WSA data is sent as byte data, so it made sense to allow byte arrays to be used directly without making the conversion to and from strings. If only a few sockets are required, we would recommend using the NewSocket class and mWinsock module directly. If however, you need multiple sockets for a server type application, then a socket array is the only viable choice. To do this, you will need an ActiveX Control or OCX. 1. Compile the NewSocket.ocx. 2. Copy NewSocket.ocx to the \Windows\System32\ directory (\Windows\SysWOW***\ on *** bit systems). You may need to Run as Adminstrator to perform this step. If you used a previous version of this control, unregister it using regsv32.exe and delete both the .ocx and .oca files before copying the new .ocx file. 3. Load the VB6 IDE and the project ocxTest. This will likely produce an error because the registration for the old control cannot be found. The control that could not be found may be replaced by a picture box temporarily. 4. In Project Components, Browse to the copied NewSocket.ocx file and add it. Note: In order to add anything to the System Registry, or to the Windows directory, you must run Visual Basic as Administrator or have UAC disabled. This process will add your new control to the component list, add the control to the registry, and create a NewSocket.oca file. The OCA file is only a cache file and speeds up the compile process. It is not required for distribution, and if the compiler cannot find it, it will recreate it. But there is a minor problem with this approach. Every time the control is compiled, a new CLSID is created. It is recommended that NewSocket.ocx be unregistered using regsvr32 before recompiling and using. Even so, you will probably leave behind multiple registry entries. By the time I got a satisfactory product, I had about a dozen excess entries in the registry for both the NewSocket.ocx and NewSocket.oca files. I went through the registry and deleted them before the final compilation. And once you register the new Control, none of the programs that use it will work anymore. I found it easier to use a simple example program (ocxTest) that loads the control but doesn't use it, for the purpose of finding the correct CLSID. The old control did not load, so add the newly registered control to the "Components" of the project, and add the new control back to the form. Verify that it runs and save the project. Using NotePad or other text editor, copy the object reference line from the .vbp file, and paste it over the same line in any other project using the same Control. Likewise, copy the object reference line in the .frm file, and paste it over the same line in any other form that uses the same Control. In this manner, the other projects should load without complaint from Visual Basic, so they can be recompiled.

近期下载者

相关文件


收藏者