cmRtNet.h/c : Sync. messages are now transmitted to the client
in _cmRtNetRecv(). Added comments.
This commit is contained in:
parent
4cd59919a2
commit
4df91dd08f
@ -608,13 +608,14 @@ cmRtNetRC_t _cmRtNetSyncModeRecv( cmRtNet_t* p, const char* data, unsigned data
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is called in the context of cmRtNetReceive().
|
||||||
void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
||||||
{
|
{
|
||||||
cmRtNet_t* p = (cmRtNet_t*)cbArg;
|
cmRtNet_t* p = (cmRtNet_t*)cbArg;
|
||||||
|
|
||||||
if( _cmRtNetIsSyncModeMsg(data,dataByteCnt))
|
if( _cmRtNetIsSyncModeMsg(data,dataByteCnt))
|
||||||
_cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr);
|
_cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr);
|
||||||
else
|
// else
|
||||||
p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr);
|
p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -707,6 +708,7 @@ cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h )
|
|||||||
cmRtNetRC_t rc = kOkNetRC;
|
cmRtNetRC_t rc = kOkNetRC;
|
||||||
cmRtNet_t* p = _cmRtNetHandleToPtr(h);
|
cmRtNet_t* p = _cmRtNetHandleToPtr(h);
|
||||||
|
|
||||||
|
// Calling this function results in callbacks to _cmRtNetRecv() (above)
|
||||||
if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC )
|
if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC )
|
||||||
{
|
{
|
||||||
cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed.");
|
cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed.");
|
||||||
|
@ -65,7 +65,9 @@ extern "C" {
|
|||||||
cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h );
|
cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h );
|
||||||
|
|
||||||
// This function must be polled to receive incoming network messages
|
// This function must be polled to receive incoming network messages
|
||||||
// via the callback funcion 'cbFunc' as passed to cmRtNetAlloc()
|
// via the callback funcion 'cbFunc' as passed to cmRtNetAlloc().
|
||||||
|
// Note that all messages received via 'cbFunc' will be prefixed with
|
||||||
|
// an cmRtNetMsg_t header (See cmRtSysMsg.h).
|
||||||
cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h );
|
cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h );
|
||||||
|
|
||||||
// Get an end point handle for use with cmRtNetSend.
|
// Get an end point handle for use with cmRtNetSend.
|
||||||
|
Loading…
Reference in New Issue
Block a user