473,657 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Could not receive more than 2KB at RECV(..) function.

Hello Developpers,
I am developping a TCP/IP Client application using Visual C++ .NET Standard on Windows 2000 Pro.

I noticed that I could not receive more than 2KB once at a time. The server application sends me intensive data. Before this, I receive a feedback command that informs about what kind of prepations I should do next statements. This feedback command is sometimes more than 2KB (2048 Bytes). If the feedback command is less or equal to 2KB, there is not any problem to receive all of it with one recv(...) functions. In the case of being greater, I should use more than one recv(...) .

In order to solve this, I changed my technique. First, I receive 2 Bytes that says me the size of the feedback command. Than, I run my recv(..) function in a while(...) loop till the expected number of Bytes are received. Than I pass to other operations.

Could you tell me how to resize the recv(..) buffer size!!! I learned that TCPWindowSize is for this purpose. But I could not find any sample.

My initial recv(...) function was as follow:
...
#define Max_Buffer_Size 30000
...
char* recvBuf = new char[Max_Buffer_Size];
int retRecvVal = recv( ClientSocket , recvBuf , Max_Buffer_Size , 0);
...

I would like to thank you in advance for your sincere guidance
Nov 17 '05 #1
1 1314
"BilMuh" <Bi****@discuss ions.microsoft. com> wrote in message
news:CE******** *************** ***********@mic rosoft.com...
I am developping a TCP/IP Client application using Visual
C++ .NET Standard on Windows 2000 Pro.

I noticed that I could not receive more than 2KB once at a time.


Sockets are most often used in a "stream" oriented, rather than "message" or
"datagram" oriented way. You _must_ be prepared for whatever the network
gives you and if necessary handling the bocking of buffers yourself.

If you switch from TCP to UDP (i.e. from SOCK_STREAM to SOCK_DGRAM) you will
get the message orientation you want. Of course then you give up
"connected-ness" and the reliability of TCP.

Regards,
Will
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1221
by: Paul Taylor | last post by:
I want to show a figure based on an numeric entry that more than 20 (or 21and higher). If Number value is 21 or higher then the amount returned is Number value * 120 (£) * 10 (%) to give a discount on 21 and higher. How to I add that function to this line of code. SAmt0 = Math.round(eval(form.Number.value * 12000 * 0.1)); form.Amt0.value = AddDecimal(SAmt0);
4
976
by: Phil Jones | last post by:
I usually like to write Function's rather than Sub's that return a Bool indicating whether the procudure was successfull (in some contextual way). I usually do this as a matter of course, whether I immedately need that flag or not (just so that the design is laid down well in the first instance in case I need to use it later - which often enough I do). What I was wondering is whether there's any perforance hit (slight as it may be)...
27
1715
by: idoerg | last post by:
Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. ################# START SOURCE ############# # The function def readgenome(filehandle): s = ''
1
2084
by: raghupise | last post by:
Hi Friends, In socket programming I want to send double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know.
0
1072
by: raghupise | last post by:
Hi Friends, In socket programming I want to connect double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know. My codesnippet:
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.