?
Solved

Max Reommended buffer size to send using (nonblocking) WSASend

Posted on 2005-04-17
4
Medium Priority
?
767 Views
Last Modified: 2008-01-09
Hi ,


My server (C++ , MSVC6) using completion-port to send huge data-buffers
to the client .
till now, i was using a single call to WSASend() to send ALL the data
(single buffer , can be 10MB-100MB ) .


I noticed that if i'm using buffer-size to be ~60MB and above , the
WSASend returns error about the size .


my question is - what is the maximum buffer size that it's recommended
to send ?


As much as i understand, if i'm sending "big" buffers , the NDIS/TDI
(or other O.S component) can split them into smaller buffers so the
TCP/IP will send 8K each time , right ? so it's better to fill-up the
"lower-layer" with the maximum buffer size that it can handle .


In another words - most implementations send 8KB-16KB because this is
the "send buffer" size, but it means that the O.S will be waiting for
new buffers , maybe it's better to send 1MB just to prevent this "O.S
waiting" .


Am i right ? any ideas ?


Thanks,


0
Comment
Question by:odedf
3 Comments
 
LVL 22

Accepted Solution

by:
grg99 earned 2000 total points
ID: 13801733
It is a good idea to buffer up data so you make fewer system calls, but there's a limit to this goodness.

If you try to send more than a megabyte or so, the paybacks get smaller and smaller, and you end up tying up system heap with your data.  Meanwhile your program gets less responsive, as it's spending a lot of time inside the system call.

I'd keep each write to a megabyte or less.

 
0
 

Author Comment

by:odedf
ID: 15414278
Pls close this thread.
No answer was accepted.

Thanks
0
 
LVL 14

Expert Comment

by:wayside
ID: 15656701
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: grg99

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

wayside
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question