![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Nov 2005
Posts: 149
Rep Power: 4
![]() |
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? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,261
Rep Power: 5
![]() |
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". |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |