Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Determining the Total Network Buffer Space Available for TCP/UDP Sockets

Posted on 2010-11-24
7
Medium Priority
?
1,090 Views
Last Modified: 2012-05-10
I have a program that has multiple TCP and UDP socket connections.  In my program, I set the send and receive buffer size for the TCP sockets and the receive buffer size for the UDP sockets using setsockopt.  However, I was wondering the following::

* How can I determine how much total network buffer space is available at program startup, so that I can determine how to divide it up between my various sockets?  Right now, I use getsockopt to see what the send or receive buffer size is set for an individual socket, but it would be nice to see the total available before creating any sockets.

* Where is the network buffer space physically located?

I am programming in C/C++ using MS Visual C++ 2010 Express on a windows 7 machine.
0
Comment
Question by:jtrades
  • 3
  • 2
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 34207666
Take a look at http://msdn.microsoft.com/en-us/library/ms819736.aspx ("TCP Receive Window Size and Window Scaling" - that's for Server 2003, but should apply for W7 also):

The default receive window size that TCP advertises in Windows Server 2003 depends on the following, in order of precedence:

    *      The value for the SO_RCVBUF Windows Sockets option for the connection. This option specifies the total per-socket buffer space reserved for receive operations.
    *      The per-interface TcpWindowSize registry value.
    *      The GlobalMaxTcpWindowSize registry value.

The buffer space is physicall located in the RAM ;o) - no, seriously, I assume that the driver(s) maintain(s) it/them on a per-interface basis and map them into your process' address space as shared segments for performance reasons.
0
 

Author Comment

by:jtrades
ID: 34219495
Thanks for the info.  However, do you know of any functions that I can call within my program to find the current total network buffer size (not just on a per socket basis)?  I want to be able to adjust the size depending on how many connections I create.  
0
 
LVL 86

Expert Comment

by:jkr
ID: 34220157
Well, as that article states, you can find them as

    *      The per-interface TcpWindowSize registry value.
    *      The GlobalMaxTcpWindowSize registry value.

So, you basically just have to read these registry values.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:jtrades
ID: 34235160
Looks like these values don't exist every time.  In some articles, the admin/user may have to add these registry values to tweak their tcp performance.  Can you think of any other values that I can obtain within my program that are more consistent?
0
 

Author Comment

by:jtrades
ID: 34235302
One more related question.  What is the max SO_RCVBUF/SO_SNDBUF that I can set?  From what I read, it seems to be 256K, but using setsockopt  I was able to maintain buffer sizes in the MB range.  Is this possible?
0
 
LVL 40

Expert Comment

by:evilrix
ID: 34824148
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

886 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