Click here to Skip to main content
15,914,608 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Happy Children's day to All! I met a problem. I can't use the derived Class from CSocket in Another Class. Pin
PJ Arends1-Jun-04 21:38
professionalPJ Arends1-Jun-04 21:38 
GeneralRe: Happy Children's day to All! I met a problem. I can't use the derived Class from CSocket in Another Class. Pin
HENDRIK R1-Jun-04 21:43
HENDRIK R1-Jun-04 21:43 
GeneralRe: Happy Children's day to All! I met a problem. I can't use the derived Class from CSocket in Another Class. Pin
ocean20003-Jun-04 1:51
ocean20003-Jun-04 1:51 
GeneralRe: Happy Children's day to All! I met a problem. I can't use the derived Class from CSocket in Another Class. Pin
ocean20003-Jun-04 1:57
ocean20003-Jun-04 1:57 
GeneralRe: Happy Children's day to All! I met a problem. I can't use the derived Class from CSocket in Another Class. Pin
HENDRIK R3-Jun-04 2:49
HENDRIK R3-Jun-04 2:49 
GeneralLost/Corrupted Packets with CAsyncSocket Pin
User 127821-Jun-04 15:12
User 127821-Jun-04 15:12 
GeneralRe: Lost/Corrupted Packets with CAsyncSocket Pin
Johnny ²1-Jun-04 23:44
Johnny ²1-Jun-04 23:44 
GeneralRe: Lost/Corrupted Packets with CAsyncSocket Pin
User 127822-Jun-04 2:56
User 127822-Jun-04 2:56 
I know they're corrupt because the results they produce don't fit in with the other data, that's the best way to describe it, I get values way beyond the bounds of what they should be. For example, below, nType, 90% of the time that should be 1 or 2, yet I frequently recieve 3s and 4s, and I know the server program isn't sending them.

I see what you mean about not fullying recieving some packets, that would make sense to some extent. What I'm sending/recieving are structs like this:

struct someMessage {
	short nType;
	float fX;
	float fY;
	unsigned int wParam;
	unsigned int lParam;
};


My OnRecieve handler looks something like this:

int nSent=0;

int nMax=20;
someMessage Msg[20];
nSent=m_Sock.Receive(&Msg,sizeof(Msg));

for(int x=0;x<nMax;x++)
{
	//... process the message
}


How can I ensure that I only grab complete "packets" and that the partials are left to be completed? I am under the impression its bad to peek at the buffer and then take action on what's in there. And according to MSDN, any unread data is lost, so I'm at a lost of how I can get the partials too?

Thanks

modified 12-Jul-20 21:01pm.

GeneralRe: Lost/Corrupted Packets with CAsyncSocket Pin
Johnny ²4-Jun-04 1:37
Johnny ²4-Jun-04 1:37 
GeneralRe: Lost/Corrupted Packets with CAsyncSocket Pin
User 127825-Jun-04 6:20
User 127825-Jun-04 6:20 
GeneralSubstitute Tite bar for window Pin
TrungHuynh1-Jun-04 15:09
TrungHuynh1-Jun-04 15:09 
GeneralExporting/importing certificates to/from a file to Internet Explorer Pin
joelvolvo1-Jun-04 14:29
joelvolvo1-Jun-04 14:29 
QuestionMultiline edit word wrap bug in XP-themed apps? Pin
David Pritchard1-Jun-04 14:27
David Pritchard1-Jun-04 14:27 
GeneralMultiline cells in grid control. Pin
richiebabes1-Jun-04 12:13
richiebabes1-Jun-04 12:13 
GeneralRe: Multiline cells in grid control. Pin
Nirav Doshi1-Jun-04 23:39
Nirav Doshi1-Jun-04 23:39 
GeneralClosing SDI application Pin
dart131-Jun-04 12:10
dart131-Jun-04 12:10 
GeneralRe: Closing SDI application Pin
Michael Dunn1-Jun-04 13:10
sitebuilderMichael Dunn1-Jun-04 13:10 
GeneralRe: Closing SDI application Pin
dart132-Jun-04 0:32
dart132-Jun-04 0:32 
GeneralMnemonic Keys not working in menus Pin
Anonymous1-Jun-04 11:38
Anonymous1-Jun-04 11:38 
Generalquestion about API Pin
Anonymous1-Jun-04 11:36
Anonymous1-Jun-04 11:36 
GeneralCToolTipCtrl::Create fails... Pin
herbert_chow1-Jun-04 11:35
herbert_chow1-Jun-04 11:35 
GeneralRe: CToolTipCtrl::Create fails... Pin
Diddy2-Jun-04 22:46
Diddy2-Jun-04 22:46 
GeneralRe: CToolTipCtrl::Create fails... Pin
herbert_chow3-Jun-04 6:09
herbert_chow3-Jun-04 6:09 
GeneralToolbar Editor Pin
Bob Stanneveld1-Jun-04 11:06
Bob Stanneveld1-Jun-04 11:06 
GeneralRe: Toolbar Editor Pin
TrungHuynh1-Jun-04 15:22
TrungHuynh1-Jun-04 15:22 

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.