HPlogo Interprocess Communication: Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 4 Special Cases of IPC

Writer Identification

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Sometimes a reader needs to know when a new writer opens the file, the records written by this writer, and when the writer closes the file and hence no longer adds records. This allows the reader to keep track of who is sending records. It also helps the reader to manage its resources, perhaps by allocating a data segment when a new writer opens the file, and releasing it when the writer closes the file. IPC provides this feature through the use of FCONTROL with a controlcode of 46.

Readers who call FCONTROL with a controlcode of 46 receive two additional words at the beginning of each record returned by FREAD. The first word contains the record type (0 = data, 1 = open, 2 = close). The second word contains a writer's ID. The writer's ID is a unique identifier assigned by the MPE/iX file system to processes that have opened a message file with WRITE access, and it is used only to associate the open, close, and data writes performed by a specific writer. If additional information is needed (such as process ID number or program name), it can be passed by the writer in the first record, and saved by the reader in a table indexed according to the writer's ID.

NOTE: The writer's ID is always written when a writer does an FWRITE. FCONTROL with a controlcode of 46 only makes it visible to the reader. Writers who call FCONTROL with a controlcode of 46 will receive an error. See the MPE/iX Intrinsics Reference Manual (32650-90028) for full syntax details on FCONTROL.
Feedback to webmaster