Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 3rd, 2007, 5:27 PM   #1
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
Winsock question

This is just a simple question, and I couldn't find the answer using google.

As far as speed at runtime, is it more efficient to add a bunch of strings together, then use send() for the whole string, or should I instead send each string, one right after the other?
Writlaus is offline   Reply With Quote
Old Dec 3rd, 2007, 6:02 PM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,261
Rep Power: 5 grumpy will become famous soon enough
Re: Winsock question

Another question unrelated to C++ <sigh>.

In general, the answer is "it depends".

In rough terms, it is often more efficient to send() a bunch of data via one function call, rather than do it multiple times. However, in the real world, efficiency depends on a few other factors. For example, it is affected by the efficiency of the code that bundles the data into one array for sending, on buffering done by the operating system that the sending application is running on, on buffering done by the operating system that the receiving application is running on, the efficiency of the code that receives the data and unpicks it, and on performance of the network between the sending and receiving applications.

In practice, the only way to determine the most efficient method is to do end to end testing of your system (with the sending application, the receiving application, a representative network topology, and representative configurations of the machines the applications are running on, etc etc). And, in practice with socket or other network applications, it is not necessary to optimise to death anyway: there is a notion of "good enough for most usage patterns".
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to post a question nnxion C++ 10 Jun 3rd, 2005 12:53 PM
How to post a question nnxion C++ 0 Jun 3rd, 2005 9:55 AM
How to post a question nnxion C 0 Jun 3rd, 2005 9:55 AM
winsock and programming tutorial question l337killa07 Visual Basic 3 May 26th, 2005 7:01 PM
WinSock accept() hangs program in Do loop... layer C++ 5 Apr 29th, 2005 12:28 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:04 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC