Async TCPClients
- From: "Shak" <me@xxxxxxxxxxx>
- Date: Mon, 19 Jun 2006 15:37:05 +0100
Hi all,
Three questions really:
1) The async call to the networkstream's endread() (or even endxxx() in
general) blocks. Async calls are made on the threadpool - aren't we advised
not to cause these to block?
2) You can connect together a binaryreader to a networkstream:
BinaryReader reader = new BinaryReader(stream);
And then read an int from it:
int i = reader.ReadInt32();
And vice versa.
Since there are no calls to beginread/endread, I presume this isn't a
synchronous call. Is there any way to make it async? Or am I missing the
point?
3) I'm trying to implement the message mechanism described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp09182003.asp
In order to answer question 2), I'm going to read the the messagetype
asynchronously, but the rest of the message synchrounously in the callback
(by tying together the binaryreader and networkstream). Is it a good idea to
do mix the two like this? What happens if the network lags, or bytes go
missing?
Thanks!
Shak
.
- Follow-Ups:
- Re: Async TCPClients
- From: Dave Sexton
- Re: Async TCPClients
- Prev by Date: Re: Disable Visual Studio's Ability To Remember Open Forms
- Next by Date: Problem adding web service
- Previous by thread: Re: Disable Visual Studio's Ability To Remember Open Forms
- Next by thread: Re: Async TCPClients
- Index(es):
Relevant Pages
|
Loading