Results 1 to 5 of 5

Thread: [Winsock] Winsock Class Implementation API

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    38

    [Winsock] Winsock Class Implementation API

    I have been in research of Winsock and its working under VB 6 for the past few weeks. I have learnt a lot! Special thanks for VBForums and its Active Members.

    I would like to share Winsock Class Implementation API which I have modified. The credit goes to the original Authors who have spent their time making our works easier.

    Why Do you need a Winsock Class API? (Winsock Control vs Winsock API)

    1. Winsock Control is an external dependency which is required in each and every system in which your Project is meant to be deployed.

    2. Winsock Control has a Memory Leak which has been described in the Microsoft Knowledge Based Articles.

    3. Encapsulation of Winsock API can ensure better working of your Applications.

    4. It also eliminates the compatibility issues with different version of OCX libraries.

    However, you cannot directly use Winsock API for Array Programming. You need to create User Control and use the control on the form.

    CSocketMaster VB6 Class API
    This is a good stable version of CSocketManger that I have found. It comes with a CSocketMaster class module and CSocketManager module which is fully compatible and ready to use under VB6 Platform. Read the

    However this version of CSocketManager has few problems with Windows Vista. There are certain problems you encounter when you try to establish a Remote Connection. You are returned with a Socket Error (Socket State 9). I have fixed this error and this makes CSocketManager fully compatible with Windows Vista.

    You can find CSocketManager_Vista file additionally in the attached documents. This Class Module has certain modifications. You can search for iProgrammer in the Class Code. I have included certain comments and tags which will help you figure out.

    Unisock
    This is a Robust Class API Implementation of Winsock which is readily compatible with Windows Vista. I have encountered a few Crashing problems while using this Class Module. You need to take special care about Opening and Closing of Sockets when you use this Class Module. Credits to Merri for his outstanding work.

    More information can be found in his post:
    http://www.vbforums.com/showthread.php?t=534580
    Attached Files Attached Files

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [Winsock] Winsock Class Implementation API

    Hmm...

    Quote Originally Posted by iProgrammer
    Why Do you need a Winsock Class API? (Winsock Control vs Winsock API)

    1. Winsock Control is an external dependency which is required in each and every system in which your Project is meant to be deployed.
    Hardly an issue. The file is tiny by today's standards, and deploying it is simple using any standard installation technique. Using reg-free COM introduced in Windows XP (2001) you don't even have to register the Winsock control.

    Quote Originally Posted by iProgrammer
    2. Winsock Control has a Memory Leak which has been described in the Microsoft Knowledge Based Articles.
    This hasn't been true since at least 2004. You're reading obsolete KB articles. This was finally put to rest in SP6 if not SP5 (2002). Microsoft really should update those things.

    Quote Originally Posted by iProgrammer
    3. Encapsulation of Winsock API can ensure better working of your Applications.
    How? Perhaps as opposed to trying to write Winsock API logic yourself? I'd agree with that.

    Quote Originally Posted by iProgrammer
    4. It also eliminates the compatibility issues with different version of OCX libraries.
    This was addressed by SxS assembly isolation introduced in Windows XP (2001).

    Quote Originally Posted by iProgrammer
    CSocketMaster VB6 Class API
    This is a good stable version of CSocketManger that I have found. It comes with a CSocketMaster class module and CSocketManager module which is fully compatible and ready to use under VB6 Platform.
    CSocket/CSocketMaster have been problematic for years, and have never worked quite correctly. This is more stable however if you destroy a CSocket and create a new one after each use instead of attempting to reuse one.


    I have no experience with Unisock, but assume that Merri has done some good work here. I'd encourage those who perceive a need for it to give it a good test by all means and do what they can to support further development. The Winsock control is stable and mature though, and it would take a lot to convince me to use something else.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    38

    Re: [Winsock] Winsock Class Implementation API

    My main intention of posting this was to help others. I have been working with Winsock for the past few days, and I know how thin the resources are. Perhaps this post could be of some use to the people who are looking for similar solutions.

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [Winsock] Winsock Class Implementation API

    I agree with the intent, Merri can stand encouragement. We all can.

    If people can benefit, that's great! He's bulked things up a bit in helpful ways, like embedding character encoding help.

  5. #5
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [Winsock] Winsock Class Implementation API

    Agree with everything dilettante pointed out, although I thought the memory leak bug still existed even after SP6. I don't remember them giving any sort of solution (like upgrading to SP6 of the controls).

    I personally don't like the CSocketMaster, always experienced some odd things with it.

    The Microsoft Winsock Control was made really well and is very reliable, and definitely worth the extra two-300KB it adds. And it's definitely better than the TCP Client/Server classes in .NET which is one of the main reasons I still use VB6 and write all my client/server programs in it.

    If you were to write something like this, I would do it from scratch and use the Asynchronous API calls.

    I would also look for one written in C++ and port it over to VB code since CSocketMaster is the only one in VB that I know of.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width