473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

internal winsock buffers

I was curious to know the size of the internal winsock read-buffer associated with a telnet socket. I wanted to know how long it would take to fill it on my internet connection, and I wanted to set my recv-buffer the same size so that a single recv would flush it.

Several Microsoft references stated that the default size was 8K. So I called getsockopt with parameters SOL_SOCKET, SO_RCVBUF to confirm this. It returned 1244364 bytes - over 1.2 MB!

I didn't trust either figure. I programmed a loop which did a blocking-recv on a remote telnet server, using a huge 2 MB buffer.. No matter how long I ran it for, the maximum size returned to each recv was 128K. recv would never return more than 128K bytes, even though it was passed a buffer-size of 2M.

I thought that this 128K might be an artefact of my internet-speed. So I had the program sleep for 20 secs after each recv. I thought that this would give the internal buffer plenty of time to fill up to its capacity. But the size returned to recv actually shrank - to exactly 74055 byte.

None of this makes a lot of sense to me. Is the "actual" internal buffer size 128K? Then what is getsockopt returning? And why does Sleep (and SleepEx) have such a bizarre effect? Surely Windows doesn't leave an internal buffer half-full just because the high level process is asleep.

Incidentally, I also tried changing the buffer-size using setsockopt. This function returned without error but had no effect on the buffer-size, regardless of its value, and regardless of whether a connection was open. A subsequent getsockopt always returned 12443644 bytes. I found a reference which stated that this is characteristic of some Windows Sockets implementations. So much for setsockopt.

I am using Microsoft C on XP Home, winsock2.h, wsock32.lib. My internet speed is 512 Kbps.
Jul 19 '07 #1
0 1880

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Niels Borg | last post by:
Hi, I'm writing app where I use WinSock, but I have experienced a problem. WinSock only sends the data after finishing the calling sub/function. Can I force WinSock immediately as I need to send...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
1
by: Yu Chai | last post by:
Hi guys, I created a ASP page that 1. users can run when WinSock proxy are using (ie's one is unchecked) 2. users can't run when WinSock proxy are using (ie's one is checked) 3. users can't run...
7
by: Nadav | last post by:
Hi I am writing some kind of a storage system that have to deal with large amounts of data passing over the net, Now, I Wonder... traditional programming would use win32 Winsock DLL as the means...
5
by: kc | last post by:
Hi Just upgrading a app from VB6 to VB.Net. All is going well apart from the Winsock control. The first thing we notice is that there does not appear to be a .Net version (please correct me if...
0
by: kgoods | last post by:
Hope someone has some ideas on this one because I'm fresh out! :) I have a SQL server on our internal network behind a linux firewall and Proxy server 2.0 (WinNT 4.0). It is the backend for an...
1
by: Nicolas Ghesquiere | last post by:
Hello I have a problem with my current program. The meaning of the program is to allow users to login to a server to allow them to access the internet. My program communicates with a MS isa...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
3
AaronL
by: AaronL | last post by:
Hello, I am currently working on a project that has me in sort of a bind. What I want to do is retrieve web pages from the internet, and strip them down to just text. I'll get using Regular...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.