Important alert: (current site time 7/16/2013 2:17:52 AM EDT)
 

winzip icon

UniSock - Winsock control replacement

Email
Submitted on: 8/12/2008 1:45:44 PM
By: Vesa Piittinen  
Level: Intermediate
User Rating: By 15 Users
Compatibility: VB 6.0
Views: 22653
author picture
(About the author)
 
     A new class implementation of Winsock API. By style close to the native Winsock control and other class implementations such as CSocket and CSocketMaster, so you don't need to learn or rewrite much of existing code. The new and cool part about this class is that it is just one class file. Also, it performs better (by speed) and handles errors a bit more cleanly (you aren't forced to close the socket each time an error occurs). Other speciality is transparent Unicode support: when you switch to text mode, you start receiving TextArrival event instead of DataArrival and start getting individual lines. These lines are automatically Unicode if received line is UTF-8 or UTF-16! ANSI lines require you to use StrConv to get an usable string, thus you have the power on what to do with the raw data before any conversion has affected it. **** Support thread and documentation: http://www.vbforums.com/showthread.php?t=534580 **** Special thanks to Paul Caton and LaVolpe for their work on SelfSub, SelfHook and SelfCallback. **** UPDATE 2008-08-12: Now Vista compatible!
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 25 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/9/2008 8:02:21 PMc0sm1c

I'm getting errors trying to run this class on vista, I'll assume its not just your code tho as CSocketMaster does not work on vista as well. Is there any winsock replacement that is compatible?
(If this comment was disrespectful, please report it.)

 
8/10/2008 10:05:29 AMc0sm1c

I was hoping this code would make a good replacement for CSocketMaster, but like CSocket it isnt vista-compatible either :(

(If this comment was disrespectful, please report it.)

 
8/10/2008 8:48:33 PMVesa Piittinen

Humm, I'll try it on Vista. I used CSocketMaster for reference to speed up development, so I've probably duplicated some troublesome behavior (and I've noticed that there is some degree of stability issues, so I may need to do changes anyway).
(If this comment was disrespectful, please report it.)

 
8/14/2008 5:16:17 AMkibe

on my Vista Ultimate SP1 work fine
(If this comment was disrespectful, please report it.)

 
8/20/2008 3:34:42 AMMasino Sinaga

I recommend you to make a small client and server sample application inside your code. It may consists of two sub folder "client" and "server". This sample will help us to understand the ability and the feature of the class. Thank you.
(If this comment was disrespectful, please report it.)

 
8/20/2008 6:38:36 AMJuned Chhipa

Amazing
Thanks
(If this comment was disrespectful, please report it.)

 
8/20/2008 6:38:50 AMJuned Chhipa

Amazing
Thanks
I'll give 5 balls
(If this comment was disrespectful, please report it.)

 
8/21/2008 11:27:45 AMHeriberto Mantilla Santamaria

Excellent code.

I'm use in a non commercial sw your UniControl UC, work perfect for me.
(If this comment was disrespectful, please report it.)

 
8/21/2008 12:34:05 PMVesa Piittinen

Masino: yeah, I agree. I also just got a report on UDP support not working, apparently an error in some API call. I simply copied to UDP support from CSocketMaster, I've never done any UDP connections myself. Thus better to make an example of all the important features so that it gets tested well enough.


I have done a further update that fixes memory issues, but I've now got a new bug that makes the application crash in IDE if the Stop button is pressed. That also needs to be resolved (just for convenience of development).
(If this comment was disrespectful, please report it.)

 
8/24/2008 7:55:13 AMSacha Devos

Cool, just what I needed. I assume data arival can be used with an array of bytes?.Anyway great control

(If this comment was disrespectful, please report it.)

 
8/25/2008 1:02:24 PMVesa Piittinen

Yes, you can use an array of bytes. You can use almost all the datatypes of VB6.
(If this comment was disrespectful, please report it.)

 
9/24/2008 6:09:10 PMxpert

Cool.
A class better than CSocket and CSocketMaster...
But... when are you going to release the update with the fixes and demos you talked about in August?
(If this comment was disrespectful, please report it.)

 
9/26/2008 4:38:07 PMVesa Piittinen

I haven't had the time: too many things (attempt to) take my time on weekends and work that I started this month keeps me too tired to concentrate in complex projects such as UniSock during the rest of the week.
(If this comment was disrespectful, please report it.)

 
9/28/2008 8:33:33 PMc0sm1c

what we need is a fixed version of CSocketMaster for vista, having it in one class would be a nice bonus though. I would love to see this stable though!
(If this comment was disrespectful, please report it.)

 
12/4/2008 3:26:27 PMVesa Piittinen

Whoa, the contest is still running! Now if I just updated the code to fix the parts that are broken to really be worth it... jobs are evil, have ran out of time pretty much in the last few months.
(If this comment was disrespectful, please report it.)

 
3/13/2009 3:46:28 PMSacha Devos

I can not figure out how to send receive arrays. does anyone have an example code ?
(If this comment was disrespectful, please report it.)

 
12/8/2009 1:27:36 AMDan

what is visual basic? what is this website about, I want to download video games
(If this comment was disrespectful, please report it.)

 
4/21/2010 2:36:18 AMJames Johnston

If WndProc is the first Function in the class it doesn't crash the IDE. But I'm having a problem getting it to work. It won't initialize properly now. Has anyone made any progress with making this more stable?
(If this comment was disrespectful, please report it.)

 
3/8/2011 5:14:11 AMcgsjh

I like it
thanks


(If this comment was disrespectful, please report it.)

 
8/13/2012 7:01:38 PMufo973

Is it compatible with windows 7?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.