Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFormView - How to change size of a view dynamically to fit the client's frame window (without manually resizing parent window)? Pin
JudyL_MD24-Sep-07 2:52
JudyL_MD24-Sep-07 2:52 
GeneralRe: CFormView - How to change size of a view dynamically to fit the client's frame window (without manually resizing parent window)? Pin
Vaclav_24-Sep-07 4:17
Vaclav_24-Sep-07 4:17 
GeneralRe: CFormView - How to change size of a view dynamically to fit the client's frame window (without manually resizing parent window)? Pin
JudyL_MD24-Sep-07 4:41
JudyL_MD24-Sep-07 4:41 
GeneralRe: CFormView - How to change size of a view dynamically to fit the client's frame window (without manually resizing parent window)? Pin
Mark Salsbery24-Sep-07 6:28
Mark Salsbery24-Sep-07 6:28 
GeneralRe: CFormView - How to change size of a view dynamically to fit the client's frame window (without manually resizing parent window)? Pin
mfc_rookie24-Sep-07 18:59
mfc_rookie24-Sep-07 18:59 
Questionhow to change sid Pin
Sudipta Mukherjee23-Sep-07 11:13
Sudipta Mukherjee23-Sep-07 11:13 
QuestionTCP stack fragments incoming data in my client/server app Pin
deerhunter8923-Sep-07 8:10
deerhunter8923-Sep-07 8:10 
AnswerRe: TCP stack fragments incoming data in my client/server app Pin
Mark Salsbery23-Sep-07 9:14
Mark Salsbery23-Sep-07 9:14 
deerhunter89 wrote:
the sockets are message-based


You state "TCP" in the thread topic but you say the sockets are message based.

If you're using TCP then your sockets are stream based. 

That means the protocol stack knows nothing more than a stream of bytes.
Since you've added your own message based protocol on top of TCP, it's
up to you to know how many bytes to receive to reassemble a "message".

I personally prefer to receive just the number of bytes I'm expecting for a given "message".
If it doesn't all come in one recv() call, then I keep an offset and number-of-bytes-remaining
variable to know how many bytes to receive on the next call and where to put them.
This eliminates double-buffering - receiving into a buffer and then assembling into another
buffer.  By tracking the number of bytes remaining for a given message, and only receiving
the number of bytes expected, it also eliminates the need to store bytes that are meant for the
next "message".

Anyway, the str___() functions aren't much use unless your messages are NULL-terminated strings.
If your messages are all ASCII, I suppose you could use the strn___() functions.
For binary data, binary copy functions are a better choice - memcpy(), CopyMemory(), etc.

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

QuestionCLI pipe io - reading/ writing simultaneously Pin
higgsbo23-Sep-07 7:50
higgsbo23-Sep-07 7:50 
QuestionSOLVED CTabCtrl and spinner control - where is is documented? [modified] Pin
Vaclav_22-Sep-07 18:54
Vaclav_22-Sep-07 18:54 
AnswerRe: CTabCtrl and spinner control - where is is documented? Pin
Mark Salsbery23-Sep-07 7:49
Mark Salsbery23-Sep-07 7:49 
GeneralRe: CTabCtrl and spinner control - where is is documented? Pin
Vaclav_23-Sep-07 12:49
Vaclav_23-Sep-07 12:49 
GeneralRe: CTabCtrl and spinner control - where is is documented? Pin
Mark Salsbery23-Sep-07 12:58
Mark Salsbery23-Sep-07 12:58 
GeneralRe: CTabCtrl and spinner control - where is is documented? Pin
Mark Salsbery23-Sep-07 13:29
Mark Salsbery23-Sep-07 13:29 
GeneralRe: CTabCtrl and spinner control - where is is documented? Pin
Vaclav_24-Sep-07 4:07
Vaclav_24-Sep-07 4:07 
GeneralRe: CTabCtrl and spinner control - where is is documented? Pin
Mark Salsbery24-Sep-07 6:09
Mark Salsbery24-Sep-07 6:09 
QuestionCheck Application Pin
Tjie Pouw22-Sep-07 18:21
Tjie Pouw22-Sep-07 18:21 
AnswerRe: Check Application Pin
Hamed Musavi22-Sep-07 22:17
Hamed Musavi22-Sep-07 22:17 
JokeRe: Check Application Pin
Sreedhar DV26-Sep-07 0:17
Sreedhar DV26-Sep-07 0:17 
JokeRe: Check Application Pin
Hamed Musavi26-Sep-07 1:20
Hamed Musavi26-Sep-07 1:20 
Questionmodeless dialog & threads Pin
Peter Weyzen22-Sep-07 17:31
Peter Weyzen22-Sep-07 17:31 
QuestionRe: modeless dialog & threads Pin
Hamed Musavi22-Sep-07 23:31
Hamed Musavi22-Sep-07 23:31 
AnswerRe: modeless dialog & threads Pin
Mark Salsbery23-Sep-07 8:24
Mark Salsbery23-Sep-07 8:24 
QuestionRe: modeless dialog & threads Pin
David Crow23-Sep-07 9:06
David Crow23-Sep-07 9:06 
AnswerRe: modeless dialog & threads Pin
Mark Salsbery23-Sep-07 9:24
Mark Salsbery23-Sep-07 9:24 

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.