by J.A. Coutts (3 Submissions)
Category: Complete Applications
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (2 Votes)
Description: CSocket2 is a Winsock Control substitute. It behaves very much like the Microsoft Winsock Control. The Winsock Control 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. Microsoft seems to have abandoned it in favor of managed code in .NET.
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.
If only a few sockets are required, we would recommend using the cSocket2 class and module directly. One such program demonstrating this is the included "Chat" program. If however, you need multiple sockets for a server type application, then a socket array is the only viable choice. The included SMTP Pseudo Server application demonstrates this approach using the cSocket.ocx ActiveX Control.
Download cSocket2 IPv6 (113 KB)