Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to centralized a bitmap Pin
Boby.George19-Sep-03 19:01
professionalBoby.George19-Sep-03 19:01 
AnswerRe: How to centralized a bitmap Pin
alex.barylski20-Sep-03 4:55
alex.barylski20-Sep-03 4:55 
GeneralBCGControlBar vs. CodeJock XTreme Toolkit Pin
Joe Woodbury19-Sep-03 18:59
professionalJoe Woodbury19-Sep-03 18:59 
GeneralRe: BCGControlBar vs. CodeJock XTreme Toolkit Pin
Taka Muraoka19-Sep-03 23:29
Taka Muraoka19-Sep-03 23:29 
GeneralUDP Sample Program Pin
Ilamparithi19-Sep-03 18:54
Ilamparithi19-Sep-03 18:54 
GeneralRe: UDP Sample Program Pin
Rickard Andersson2020-Sep-03 2:15
Rickard Andersson2020-Sep-03 2:15 
GeneralData sending problem in CSocket Pin
Jegan Sasi19-Sep-03 18:50
Jegan Sasi19-Sep-03 18:50 
GeneralRe: Data sending problem in CSocket Pin
Luis Mejia20-Sep-03 10:42
Luis Mejia20-Sep-03 10:42 
Jegan Sasi wrote:
OnReceive() will not return error value. It recieves only two packets for 10 packets sending
OnReceive() is executed 2 times not 10 times to check the return value ok.


That maybe caused by the Nagle algorithm. It is not an error. In fact is efficient and all your data is being sent and received. In very simple terms, the Nagle algorithm consolidates several packets of information sent in a short amount of time into just one send. It is completely transparent to your application.

Even if you disable Nagle you have no control over how the data is received on the other end, the other system may be busy to respond to a receive right away when another chunk of data comes, it will consolidate the whole thing and by the time a receive is processed it will receive both chunks as one.

So, the problem here is that you are assuming that each receive is an individual piece of text.

If all you are doing is sending text back and forth, I suggest you buffer your receives until you reach an end of string (let's say a NULL char) and then do whatever with it.

Remember that there is no guarantee that a receive will contain a whole string, so you have to buffer it until you reach your NULL char, probably on a subsequent receive. Then extract your string from your buffer and keep the rest of the buffer which can contain the beginning of another string to be terminated on another receive.

As a matter of fact, your buffer may very well contain 3 complete strings and a portion of a 4th one. So code accordingly.

Hope this helps,
-Luis
GeneralHotkey combinations Pin
ironhead19-Sep-03 17:59
ironhead19-Sep-03 17:59 
GeneralShellExecute Pin
hemanheman19-Sep-03 15:47
hemanheman19-Sep-03 15:47 
GeneralRebar and Toolbars Pin
fgabrieli19-Sep-03 11:30
fgabrieli19-Sep-03 11:30 
GeneralFont dialog problems Pin
halblonious19-Sep-03 11:12
halblonious19-Sep-03 11:12 
Generalperformance question Pin
Gary Kirkham19-Sep-03 10:59
Gary Kirkham19-Sep-03 10:59 
GeneralRe: performance question Pin
Joe Woodbury19-Sep-03 12:35
professionalJoe Woodbury19-Sep-03 12:35 
GeneralRe: performance question Pin
Tim Smith19-Sep-03 12:40
Tim Smith19-Sep-03 12:40 
GeneralRe: performance question Pin
Gary Kirkham19-Sep-03 13:26
Gary Kirkham19-Sep-03 13:26 
GeneralRe: performance question Pin
Gary R. Wheeler20-Sep-03 3:28
Gary R. Wheeler20-Sep-03 3:28 
GeneralRe: performance question Pin
Gary Kirkham20-Sep-03 11:52
Gary Kirkham20-Sep-03 11:52 
GeneralRe: performance question Pin
Gary R. Wheeler20-Sep-03 14:13
Gary R. Wheeler20-Sep-03 14:13 
Generalpassing data structures Pin
Sirrius19-Sep-03 10:36
Sirrius19-Sep-03 10:36 
GeneralRe: passing data structures Pin
Michael Dunn19-Sep-03 11:11
sitebuilderMichael Dunn19-Sep-03 11:11 
GeneralRe: passing data structures Pin
Sirrius19-Sep-03 14:36
Sirrius19-Sep-03 14:36 
GeneralRe: passing data structures Pin
Sirrius19-Sep-03 13:00
Sirrius19-Sep-03 13:00 
GeneralWord wrap in Rich Edit and multiline edit Pin
insanely42019-Sep-03 9:07
insanely42019-Sep-03 9:07 
GeneralRe: Word wrap in Rich Edit and multiline edit Pin
David Pritchard1-Jun-04 14:21
David Pritchard1-Jun-04 14:21 

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.