help with CAsyncSocket

I have both server and client sockets, Clients send data each time a frame of a video is display, I need the server receives in exactly the same order the client sended it. I display the data received by the server in a list control, however in appears like in a random order. What I did was to create my class that inherits from CAsyncSocket and implement the OnReceive, and this methods sends a message to my main dialog. Any clue of why I am getting this??? In my client the nagleĀ“s algorith is disable I dont know if this has relation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
void SocketAsync::OnReceive(int nErrorCode) 
{ TCP_PACKET recibo;
  bytesRecv=Receive((char *)&recibo, dataLen);
  if (bytesRecv > 0) 
    { if (bytesRecv == dataLen) 
        { unsigned char status=recibo.header;
	  CString cadena = toStringf(recibo.fdata[0])+
                            toStringf(recibo.fdata[1])+
                           toStringf(recibo.fdata[2])+ 
                           toStringf(recibo.fdata[3])+
                           toStringf(recibo.fdata[4])+
                           toStringf(recibo.fdata[5]);
	  AfxGetMainWnd()->SendMessage(WM_STATUSMESSAGE, (WPARAM)status, (LPARAM)cadena.AllocSysString());   
	    				}

	   else
		 {  AfxMessageBox("Data incomplete");
		 }	
	  } 
         else 
	 { if (GetLastError() != WSAEWOULDBLOCK) 
		{  AfxMessageBox("Socket Error. Unable to read data.");
		} 
	 }
  }

Topic archived. No new replies allowed.