In response to the post:
On Fri, 29 Apr 2005 15:36:11 -0500, "Kyle" <me@privacy.net>
stated...and I replied:
>I don't quite understand your statement "TCP/IP is a stream and does
>not send packets ". TCP/IP is all packet based isn't it? A computer
[quoted text clipped - 6 lines]
>assembly? I am not a Winsock jock, just a lowly Winsock newbie who
>has used Winsock for some UDP packet send/receive programming.
Yes, when you get down to the nuts and bolts of HOW WinSock transmits
the data across the internet, it is in Packet form...how else could it
be in the Packet based World of TCP. But, when your program is
presenting the data to WinSock for transmission, it is sent all at one
time (even if you break it up into chunks, which I suggest if it is in
total bigger than say 10K).
Let's say you have a 50Mb file to send (this is huge on a dial-up
connection and will take a LONG time to send). You take the original
file, break it up into segments of 10K each. When you send each
segment you preceed it with a header that tells the receiver what
segment number it is, it's start byte and end byte followed by the
actual data. As each 10K segment is dropped onto WinSock, it breaks
it up further into say 1K byte chunks, sends it to the reciever's
Winsock using TCP, where it is internally reassembled into the 10K
segment and presented to the receiving program as a stream of data in
the Receive event. The program strips the header and holds the data,
or writes it out to disk, or somehow retains it for reassembly into
the original 50Mb file.
Therefore:
To your program, WinSock is a Stream protocol.
To WinSock, TCP is a Packet protocol.
There can be confusion due to this.
Hope this helps,
Shell