Re: send-receive using CSocket
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 29 Nov 2005 10:55:08 -0500
In addition to all of Josh's comments...
Be aware that if you send a buffer, that the receive does not receive the same information
length as was sent. For example, if you send 8K bytes, an 8K receive may or may not
receive 8K bytes; it may receive many fewer. It is your responsibility to reassemble the
bits on the other side.
TCP only guarantees that you will receive every byte sent, in order, with no errors and no
duplicates, OR you will get an error notification on both sides that there is a
communications problem. It does not guarantee that the receiver receives packets of the
same size that were sent, and in general this will *never* be true. So you will receive
the data in little pieces (if you're at the end of a SLIP connection, possibly in 256-byte
pieces!) of varying and unpredictable length.
joe
On 28 Nov 2005 12:30:33 -0800, "Josh McFarlane" <darsant@xxxxxxxxx> wrote:
>mayara wrote:
>> hi everyone .i`m doing a project for capturing the
>> desktop image & sending it from server to client " i convert it to DIB
>> then send the buffer of DIB using TCP " when i try to do a
>> StretchBIBits on client the image is not so complete it has some
>> missing pieces
>> think the problem may be in my send-receive code.can u help me with a
>> strong and reliable send-receive code??
>
>First off: You may want to stop using CSocket, as it has problems. Take
>a look at CAsyncSocket and try using that.
>
>Second off: Is your image a constant size buffer? If not, how do you
>know the exact dimensions of the image?
>
>What kind of package are you transmitting across the buffer? Just the
>image buffer? Or are you also transmitting height, width, color
>information, etc. If you are transmitting more information, are you
>receiving all of it, or just part of it, or is it invalid?
>
>Josh McFarlane
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- send-receive using CSocket
- From: mayara
- Re: send-receive using CSocket
- From: Josh McFarlane
- send-receive using CSocket
- Prev by Date: Re: How to implement an ActiveX Combo control
- Next by Date: Re: How to enumerate network printers
- Previous by thread: Re: send-receive using CSocket
- Next by thread: Re: send-receive using CSocket
- Index(es):
Relevant Pages
|