This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern for current CERN information.
Quentin's JET UDP based RT comms stuff
Anyway, as promised, you can look at the UDP based library I wrote at JET for RT communications.It is available on the SL controls NFS server here:
/user/pclhcdev/rtcomms
I also attach the same thing zipped for PC users... however, the files are in Unix format, i.e. they are terminated with only \n and not \n\r as PC's expect. So you won't be able to view it with notepad (it's all one long line).
zip file here
Try Wordpad with a fixed width font (tabs won't be right but it'll be readable) or a proper source editor which accepts Unix files. There are lots of source files because I use one file per function and start with the documentation, which is often longer than the code (this was extracted to make man pages during the build).
Looking at the header added by the library, I see it contains four long words:
typedef struct
{ u_long type, length, index, time; }
c6head_s;
So I did already have a type identifier, which can be used to ensure version control for the structures being shared. Index is the message sequence number and time was in milliseconds and was used for latency calculations. Looking at the connection structure I see that the index was used for:
u_long num_msgs, num_lost_msgs, max_lost_msgs;
u_long num_out_of_synch_msgs, num_repeat_msgs;
So the receiver keeps statistics for the number of lost messages, out of synch messages and repeated messages. It also does quite sophisticated latency logging with 1 ms bins from 0-49ms and 50+ ms.
I remember that a single UDP port can be used to receive messages of different types, and for each type there can be different callback function registered, and separate statistics.
The only remaining issue is the payload. This must be mapped with a C structure, shared between sender and receiver. Which is fine if they are both big endien or little endien.
The problem is more complex if one is a PC and the other a PPC when byte swapping becomes an issue. This could be addressed using xdr from the SUN RPC system, or no doubt by various other methods. It seems to me that this could be adapted quite easily for LynxOS and would provide useful functionality for the BI/SPS tests.