|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I know all data has been received?Hi all,
I'm using Socket and to send some data (3Mb, 4MB, or more than that). I convert data to byte array and use Send method and data is successfully sent. From other side, I use Receive method. I put data in a file and when all data has been received, I have to close the file. The poblem is I don't know when all data has been received. I use Available property, but it gives 0 although data is still coming. Now I'm using blocking socket. Do I need to use Asynchronous socket? If so, how can I do? On internet, I see some example, it send total number of bytes to send before the data is send. If I do like that, the problem is ok. But I don't want to send "total bytes to send" to other side. How can I solve this problem. Thanks, Ant. Hi
Look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingnon-blockingserversocket.asp ManualResetEvent is used in above example. I think that is what you need. -- Show quoteRegards, Inna Stetsyak aka InK_ "Ant Htoo Naing" <AntHtooNa***@discussions.microsoft.com> wrote in message news:88CBEB8A-8CA1-48C4-AF20-CFDDC4F4F71E@microsoft.com... > Hi all, > I'm using Socket and to send some data (3Mb, 4MB, or more than that). I > convert data to byte array and use Send method and data is successfully sent. > From other side, I use Receive method. I put data in a file and when all data > has been received, I have to close the file. The poblem is I don't know when > all data has been received. I use Available property, but it gives 0 although > data is still coming. Now I'm using blocking socket. Do I need to use > Asynchronous socket? If so, how can I do? On internet, I see some example, it > send total number of bytes to send before the data is send. If I do like > that, the problem is ok. But I don't want to send "total bytes to send" to > other side. How can I solve this problem. > Thanks, > Ant. |
|||||||||||||||||||||||