Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / April 2005



Tip: Looking for answers? Try searching our database.

Winsock Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ray Woods - 26 Apr 2005 23:06 GMT
Can anyone tell me how much data can be fetched on each Data Arrival event
in Winsock. What happens if the limit is exceeded and how do you cater for
such cases were the data being fetched is larger than the max if there is
one.

I've written a program which steers through a Menu on an external device
normally controlled by keyboard inputs in a Telnet session. When I send an
input to the external device some of the information being received is
missing because I think it is too long. Also characters which I'm
transmitting to steer the menu on the external device appear in the Data
Arrival event routine. I was under the impression that the TX and RX are to
separate paths. I forgot to mention that I'm using TCP mode in Winsock.

Thanks to anyone who can give me any advise of were I'm going wrong :-)

Ray
btpanek09@yahoo.com - 29 Apr 2005 13:46 GMT
how much data can be fetched on each Data Arrival event :
This is determined by the network but is approximately 1,500 bytes.

What happens if the limit is exceeded?
With TCP/IP the message is split into pieces and reassembled at the
other end.  TCP/IP is a stream and does not send packets of data (UDP
does send packetized data)

TX and RX are separate.
With TCP/IP you need a buffer in which to reassemble the passed message
and the message should contain start and end bytes so you can find it
in the stream.
Kyle - 29 Apr 2005 21:36 GMT
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
might send/receive a message via a Winsock socket, but the data is
broken down into packets for transmission over the internet.  TCP/IP
is reliable and UDP is not.  I guess maybe this depends on the
programming mechanism one is using for communications.  Direct Winsock
usage will result in data appearing in the receive buffer one packet
at a time, or are you simply stating Winsock will perform the packet
assembly?  I am not a Winsock jock, just a lowly Winsock newbie who
has used Winsock for some UDP packet send/receive programming.

Signature

Best regards,
Kyle

| how much data can be fetched on each Data Arrival event :
| This is determined by the network but is approximately 1,500 bytes.
[quoted text clipped - 8 lines]
| and the message should contain start and end bytes so you can find it
| in the stream.
Shell - 30 Apr 2005 22:35 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.