Click here to Skip to main content
15,920,687 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A problem! Pin
Christian Graus6-Feb-02 14:24
protectorChristian Graus6-Feb-02 14:24 
QuestionCAsyncSocket will recv all packets in one recv? Pin
AnonymousBabe@usa.net6-Feb-02 13:49
AnonymousBabe@usa.net6-Feb-02 13:49 
AnswerRe: CAsyncSocket will recv all packets in one recv? Pin
Tim Smith6-Feb-02 15:27
Tim Smith6-Feb-02 15:27 
GeneralRe: CAsyncSocket will recv all packets in one recv? Pin
AnonymousBabe@usa.net6-Feb-02 16:32
AnonymousBabe@usa.net6-Feb-02 16:32 
GeneralRe: CAsyncSocket will recv all packets in one recv? Pin
markkuk6-Feb-02 20:35
markkuk6-Feb-02 20:35 
AnswerRe: CAsyncSocket will recv all packets in one recv? Pin
AnonymousBabe@usa.net6-Feb-02 21:33
AnonymousBabe@usa.net6-Feb-02 21:33 
GeneralRe: CAsyncSocket will recv all packets in one recv? Pin
6-Feb-02 22:16
suss6-Feb-02 22:16 
GeneralRe: CAsyncSocket will recv all packets in one recv? Pin
Peter Weyzen7-Feb-02 10:10
Peter Weyzen7-Feb-02 10:10 
I tend to treat a TCP stream just like you treat a record/segment-based file. The stream is a series of segments, each segment should contain a header on it.

The segment header contains information about the segment you are reading -- most importantly the size of the segment. I also tend to mark each header with a 'signature' marker too.

struct segmentHeader
{
   WORD m_Signature;   // some marker that's easy to recognize 'SH'
   WORD m_SegmentSize; // size of segment including header
} 


So, as you read the incoming TCP stream, you read a chunk of data (which may be a partial segment, or a bunch of segments) and given what you know about your stream format, you can act accordingly.

What am I trying to say here -- well, the gist is this: Treat a TCP connection just like a flakey file connection. Make sure that the data which you feed into the stream has a defined 'format' which can be recognized at the other end of the connection.
Generalconverting Pin
6-Feb-02 13:26
suss6-Feb-02 13:26 
GeneralRe: converting Pin
Christian Graus6-Feb-02 13:51
protectorChristian Graus6-Feb-02 13:51 
GeneralRe: converting Pin
Paul M Watt6-Feb-02 14:21
mentorPaul M Watt6-Feb-02 14:21 
GeneralRe: converting Pin
Paul M Watt6-Feb-02 18:13
mentorPaul M Watt6-Feb-02 18:13 
GeneralRe: converting Pin
Tim Smith6-Feb-02 15:05
Tim Smith6-Feb-02 15:05 
GeneralMoving Controls on a Dialog Pin
John Clump6-Feb-02 12:31
John Clump6-Feb-02 12:31 
GeneralRe: Moving Controls on a Dialog Pin
Joaquín M López Muñoz6-Feb-02 12:35
Joaquín M López Muñoz6-Feb-02 12:35 
GeneralRe: Moving Controls on a Dialog Pin
John Clump6-Feb-02 14:48
John Clump6-Feb-02 14:48 
GeneralRe: Moving Controls on a Dialog Pin
Josh Koppang6-Feb-02 12:42
Josh Koppang6-Feb-02 12:42 
GeneralRe: Moving Controls on a Dialog Pin
Josh Koppang6-Feb-02 12:49
Josh Koppang6-Feb-02 12:49 
GeneralRe: Moving Controls on a Dialog Pin
John Clump6-Feb-02 16:19
John Clump6-Feb-02 16:19 
GeneralRe: Moving Controls on a Dialog Pin
Josh Koppang6-Feb-02 23:39
Josh Koppang6-Feb-02 23:39 
GeneralRe: Moving Controls on a Dialog Pin
John Clump7-Feb-02 17:46
John Clump7-Feb-02 17:46 
GeneralRe: Moving Controls on a Dialog Pin
jagadish bharath2-Aug-02 0:47
jagadish bharath2-Aug-02 0:47 
GeneralFirst word Pin
6-Feb-02 12:05
suss6-Feb-02 12:05 
GeneralRe: First word Pin
Michael Dunn6-Feb-02 12:03
sitebuilderMichael Dunn6-Feb-02 12:03 
GeneralRe: First word Pin
Josh Koppang6-Feb-02 12:16
Josh Koppang6-Feb-02 12:16 

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.