Browse Source

cmRtNet.h/c : Sync. messages are now transmitted to the client

in _cmRtNetRecv().
Added comments.
master
Kevin Larke 10 years ago
parent
commit
4df91dd08f
2 changed files with 6 additions and 2 deletions
  1. 3
    1
      cmRtNet.c
  2. 3
    1
      cmRtNet.h

+ 3
- 1
cmRtNet.c View File

608
   return rc;
608
   return rc;
609
 }
609
 }
610
 
610
 
611
+// This is called in the context of cmRtNetReceive().
611
 void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
612
 void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
612
 {
613
 {
613
   cmRtNet_t* p = (cmRtNet_t*)cbArg;
614
   cmRtNet_t* p = (cmRtNet_t*)cbArg;
614
   
615
   
615
   if( _cmRtNetIsSyncModeMsg(data,dataByteCnt))
616
   if( _cmRtNetIsSyncModeMsg(data,dataByteCnt))
616
     _cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr);
617
     _cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr);
617
-  else
618
+  // else
618
     p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr);
619
     p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr);
619
   
620
   
620
 }
621
 }
707
   cmRtNetRC_t rc = kOkNetRC;
708
   cmRtNetRC_t rc = kOkNetRC;
708
   cmRtNet_t*  p  = _cmRtNetHandleToPtr(h);
709
   cmRtNet_t*  p  = _cmRtNetHandleToPtr(h);
709
 
710
 
711
+  // Calling this function results in callbacks to _cmRtNetRecv() (above)
710
   if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC )
712
   if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC )
711
   {
713
   {
712
     cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed.");
714
     cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed.");

+ 3
- 1
cmRtNet.h View File

65
   cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h );
65
   cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h );
66
 
66
 
67
   // This function must be polled to receive incoming network messages
67
   // This function must be polled to receive incoming network messages
68
-  // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc()
68
+  // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc().
69
+  // Note that all messages received via 'cbFunc' will be prefixed with
70
+  // an cmRtNetMsg_t header (See cmRtSysMsg.h).
69
   cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h );
71
   cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h );
70
 
72
 
71
   // Get an end point handle for use with cmRtNetSend.
73
   // Get an end point handle for use with cmRtNetSend.

Loading…
Cancel
Save