IOCP question: ordering of data
- From: Ulrike Urban <ULUR@xxxxxxxxxxxxx>
- Date: Mon, 18 Jun 2007 12:05:45 +0200
Hi,
I'm messing around with TCP programming using iocps (XP Pro)
If multiple iocp-worker threads are used, how data-corruption can be avoided.
Example:
- Thread #1 WSASends a block of data.
This send could not completely be done by winsock, so the completion
notification comes back with according byte counts, (bytes_sended <
bytes_to_be_sended).
Thread #1 tries to WSASend the rest of the data-block
- just before issuing the WSASend, Thread #1 is preempted by Thread #2
Thread #2 WSASends another block of data.
Here data corruption may/will occur.
In such a scenario (it is never guaranteed that winsock is able to send all data of a WSASend-Call, the app may be required to re-send the rest)
how can multiple threads work properly?
My understanding is that if I issue only ONE WSASend on one socket, data integrity can be guaranteed.
This implies that multiple sends issued from multiple threads to one socket does not make sense. Multiple sends from one thread would be ok.
But then there is no advantage using multiple threads...
.
- Follow-Ups:
- Re: IOCP question: ordering of data
- From: Alexander Nickolov
- Re: IOCP question: ordering of data
- Prev by Date: RE: URLDownloadToCacheFile timeout with pluggable protocol handler
- Next by Date: LSP Bandwidth limiting implementation question
- Previous by thread: Re: Getting Detailed NIC Info
- Next by thread: Re: IOCP question: ordering of data
- Index(es):
Relevant Pages
|