Seeking complete asynchronous, thread-safe TCP/UDP socket implementation for VB.NET
Posted on 2004-10-04
I am currently migrating to VB.NET, and have converted all of my VB6 projects to VB.NET, however, I would like to get away from the dependency on the old winsock library and go to full framework dependency. My problem is, the Sockets namespace in general is driving me nuts! Instead of creating an array of Winsock controls and dealing with them, I now have to consider thread safety, etc.
I have spent the last 18 hours scouring the net for either instructions, or an actual class that mimics the Winsock control as closely as possible, and have found none that encompass both thread-safety and asynchronous callbacks.
The info / class I'm looking for needs to include:
Proper use of creating a thread-safe method of creating an asynchronous 'listen' and 'connect' connection, including data retrieval/closing
Proper implementation of a thread-safe Event for both of these.
As an example, I am porting a VB6 game server to VB.NET, and need the server to be able to handle multiple connections as it did in VB6, by having one Winsock control listen for connections, then handing off the RequestID to a separate array of Winsock controls.
I have not had time to experiment with UDP yet, but I'm assuming it's similar to TCP, but I'd like information on doing this asynchronously as well.
I will increase points for more detailed information, up to 500 for a complete class. It'd be worth a lot more to me, but unfortunately I've noticed that a cap has been placed on points awarded. Please note that, in the interest of rewarding the person who has helped me out the most, I'd like to refrain from splitting points, so if it's just a small code snippet here or there, or a URL to a site that doesn't provide more than what I am looking for, I'll avoid considering the comment as an answer. Sorry guys, but limiting the points a guy can reward limits the people he can reward. :\