Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDrawing background on a CEdit ? Pin
Christian Graus7-Dec-05 13:44
protectorChristian Graus7-Dec-05 13:44 
AnswerRe: Drawing background on a CEdit ? Pin
PJ Arends7-Dec-05 16:46
professionalPJ Arends7-Dec-05 16:46 
GeneralRe: Drawing background on a CEdit ? Pin
Christian Graus7-Dec-05 16:59
protectorChristian Graus7-Dec-05 16:59 
QuestionHelp wanted with Windows Sockets Pin
cgb1437-Dec-05 11:04
cgb1437-Dec-05 11:04 
QuestionRe: Help wanted with Windows Sockets Pin
Roger Stoltz7-Dec-05 12:01
Roger Stoltz7-Dec-05 12:01 
AnswerRe: Help wanted with Windows Sockets Pin
cgb1438-Dec-05 3:32
cgb1438-Dec-05 3:32 
GeneralRe: Help wanted with Windows Sockets Pin
Moak11-Dec-05 23:09
Moak11-Dec-05 23:09 
AnswerRe: Help wanted with Windows Sockets Pin
Jörgen Sigvardsson7-Dec-05 12:03
Jörgen Sigvardsson7-Dec-05 12:03 
cgb143 wrote:
. Can I control data flow, if so how?

Yes. Just don't read the data as soon as it arrives. The effect will be that the operating system will stop acking the TCP packets from the originating klient. Basically, the faster you read, the faster the other side can send.

cgb143 wrote:
I could try to fix the 'memory overflow' by increasing the buffer sizes, but I fear this will only delay the crash until the larger buffer overflows. Suggestions welcome

It sounds like you need a better buffering scheme. First of all, you should consider using a dynamic buffer for storing your incoming data. Perhaps a queue of buffers? So whenever a buffer is full, create a new one and append it to the queue, and write the incoming data to that one. When you've "emptied" a buffer (front of queue) by reading all the data in it, remove it from the queue. If your application needs speed, you can always keep a pool of preallocated and unused buffer from which you take buffers whenever you need a new, and into which you put old and used buffers. Your code may also need to expand the pool of unused buffers, should you run out of buffers.

You should also manage the data flow better. A rule of thumb is to not read data at a faster rate then you can process it. That way it will be harder to perform a Denial of Service attack on your application.

--
Pictures[^] from my Japan trip.
GeneralRe: Help wanted with Windows Sockets Pin
cgb1438-Dec-05 3:43
cgb1438-Dec-05 3:43 
GeneralRe: Help wanted with Windows Sockets Pin
Jörgen Sigvardsson8-Dec-05 4:40
Jörgen Sigvardsson8-Dec-05 4:40 
QuestionHow to resize a dynamic array??? Pin
Ming Luo7-Dec-05 10:52
Ming Luo7-Dec-05 10:52 
AnswerRe: How to resize a dynamic array??? Pin
Jörgen Sigvardsson7-Dec-05 11:56
Jörgen Sigvardsson7-Dec-05 11:56 
GeneralRe: How to resize a dynamic array??? Pin
Matt Godbolt7-Dec-05 12:07
Matt Godbolt7-Dec-05 12:07 
GeneralRe: How to resize a dynamic array??? Pin
Jörgen Sigvardsson8-Dec-05 1:25
Jörgen Sigvardsson8-Dec-05 1:25 
QuestionWindows Start/Boot time Pin
Inocentric7-Dec-05 10:38
Inocentric7-Dec-05 10:38 
QuestionCfileDialog file filtering Pin
Crislen7-Dec-05 9:27
Crislen7-Dec-05 9:27 
AnswerRe: CfileDialog file filtering Pin
David Crow7-Dec-05 9:55
David Crow7-Dec-05 9:55 
QuestionUsing SQLXML, Bulk Insert XML with IDENTITY Column ... Pin
cmacgowan7-Dec-05 8:48
cmacgowan7-Dec-05 8:48 
AnswerRe: Using SQLXML, Bulk Insert XML with IDENTITY Column ... Pin
cmacgowan7-Dec-05 8:52
cmacgowan7-Dec-05 8:52 
Question[Message Deleted] Pin
NET_GEEK7-Dec-05 8:44
NET_GEEK7-Dec-05 8:44 
AnswerRe: Classic visual C++ and Visual C++.net Pin
Nish Nishant7-Dec-05 8:50
sitebuilderNish Nishant7-Dec-05 8:50 
QuestionMy dialog's close button not working? Pin
G Haranadh7-Dec-05 7:56
G Haranadh7-Dec-05 7:56 
AnswerRe: My dialog's close button not working? Pin
Shay Harel7-Dec-05 8:21
Shay Harel7-Dec-05 8:21 
GeneralRe: My dialog's close button not working? Pin
G Haranadh7-Dec-05 8:40
G Haranadh7-Dec-05 8:40 
QuestionRe: My dialog's close button not working? Pin
David Crow7-Dec-05 9:06
David Crow7-Dec-05 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.