Re: synchronization control between the socket sender and socket recei
- From: herbert422@xxxxxxxxx
- Date: 10 Jan 2007 16:35:50 -0800
A potential solution for the issue of sender sending faster than
receiver receiving is to use an acknowledgement scheme. Example in
pseudo-code:
Client Application:
while(notFinishedSending){
msg = CreateMessage("Can I send 10 packets over?")
Send(msg)
Receive(response)
if(response == yes){ Send(10 packets of data) }
else{ wait(1 second)}
}
obviously this solution requires a bit more coding invovled, the second
question I am unable to understand it, can you please rephrase?
Vic wrote:
I have several files from the server side, and they need to be sent to the
client side in parallel. (Working on PC, VC6 suing ws2_32.lib)
After the client received the data, different consumers use the data in
parallel.
We plan to use socket (TCP) to transform the data through one single port,
and the server side send the data from different files one by one.
For example, we have file 1, 2, 3, then the server send socket of data from
the files in sequence, like: 1, 2, 3, 1, 2, 3, 1, 2, 3.....
Sender's speed is faster than receiver's speed. Some files maybe consumed
faster than other files.
The problem is how to control the synchronization between the sender and
receiver?
If we do not control the synchronization, when more data arrive then can be
consumed, data will be lost.
If at the receiver side, do not request the socket of data until it is used,
or we have enough space to save the data,
then the socket will be blocked by the slowest consumer.
Could you please tell me the best way to solve this problem? Your helpful
suggestions are highly appreciated!
Thanks!
Victor
.
- Follow-Ups:
- Prev by Date: Re: Problems Converting Object to Byte[]
- Next by Date: Re: synchronization control between the socket sender and socket r
- Previous by thread: Re: Windows printer port API or component ?
- Next by thread: Re: synchronization control between the socket sender and socket r
- Index(es):
Relevant Pages
|