
12-06-2004, 01:03 PM
|
 |
Senior Contributor
* Expert *
|
|
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
|
|
|
Short answer: Not really
Long answer: Well, yes, but it works on a different theory. There are two ways you could go about it, but both take you out of "synchronous" socket programming. You could spawn a new thread that calls .Recieve (since it blocks, you dont want it on the main thread), and when it gets data it raises an event via a delegate or WithEvents/event (essentially the same thing, delegates just give you more control).
But, if you go that route, the sockets already have something like that built in. It is called asynchronous sockets. Unfortunately, this makes programming sockets far more difficult (though not impossible, and you get many many benefits) as the sockets work independantly of the main thread execution and is all done through Callback delegates (in a thread pool). Synchronizing data becomes a hassle because of the threading, you need to keep states of each socket as the same thread is not guaranteed to work on the same socket each time (due to thread pool), the callback delegates often times end up calling other callback delegates to get/send more information, and sharing data is extremely daunting.
That said, it provides extremely scalable interface, high performance, etc etc. Just more to think about.
|
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)
"Perl - The only language that looks the same before and after RSA encryption."
|