Multitask access to a network card
If a network card is to be used from several real-time contexts (tasks), it must be implemented as described here.
- A TCP/UDP RT object must be created for each real-time context (e.g. task) from which data is to be received or sent.
- The PassiveMode parameter on all TCP/UDP RT objects specifies whether or not these objects should fetch frames received from the RT Ethernet adapter. By default, PassiveMode is set to FALSE so that packets are fetched.
For multitask access, only one TCP/UDP RT object should fetch the data and all other objects should be configured with PassiveMode to TRUE.
Typically, this can be the object that receives packets in the fastest cycle. Where appropriate, a lower priority can be used for this in order to make the real-time processes of other tasks more independent of the incoming frames. - The function block must call the RegisterReceiver() / Open() method in the same context as it calls the CheckReceived() method in the cyclic process.
- The callbacks via ReceiveData()/...Event() are called in the same context as the CheckReceived() from the function block of the application previously.