![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? 3) I'm trying to implement the message mechanism described here: http://msdn.microsoft.com/library/de...rp09182003.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 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |