If the setting must be done from a configuration file, so that to be adaptable from another code, without having to open vsTASKER and change the setting, specify here the configuration file that will be used by the SockItem at creating time, on the simulation engine, for setup. The file must exist and be accessible at runtime.
Content of the file shall be the following, in a text file:
Specify here at which frequency the SockItem runtime code will be called to process the received data.
If the frequency of the receiver is lower than the one of the sender, some data will be lost as they are not pooled (on UDP). If the frequency of the receiver is higher then the one of the sender, some calls will just be skipped because of no new data available.
Select from the drop down list the kind of transmission the socket will operate. Bear in mind that some casting require special IP addresses.
Unicast: default, peer to peer communication. Local 127.0.0.1 or any other IP will do.
Multicast: unique emitter and multiple receiver. Multicast addresses range from 224.0.0.0 to 239.255.255.255. Receivers must register to the multicast group address. (UDP only)
Broadcast: all nodes of the subnet will see the traffic (UDP only).
Put in this panel all data you want to add in the current SockItem. Public data is used to generate the Dyn-UI so, consider carefully what you put in the Public: data section.
No constructor and destructor should be added here. Use instead the Initialization panel.
This part is called automatically at instantiation (INIT), when SockItem is created using new, or every time the object is RESET and finally at destruction (CLEAN) using delete.
Itis a good practice to put in the RESET part whatever must be reinitialized at reset. There is no break after INIT to allow the RESET part to be processed after INIT, at Socket creation time.
This part is called by tic(Event*)at the specified frequency. It is an automatic routine of the SockItem so, all data of the SockItem can be accessed here.
Senders: if triggering mode is Cycle on Event, use event of type Event*. if Cycle at set, no argument is available. Use scen() to get the data you need.
Receivers: Use msg of type MsgData* and cast it according to the type of data you are expected on this socket.
Sometimes, the number of messages are numerous and to not wait for the next cycle to read the queued ones, use return AGAIN; but beware of blocking the simulation if continuous messages are coming. Better put a limit in the number or return AGAIN allowed per cycle.