Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!ucbvax!UFRJ.BITNET!COS99284 From: COS99284@UFRJ.BITNET (Luiz Felipe Perrone) Newsgroups: comp.sys.transputer Subject: Anarchic protocol ANY (occam2) Message-ID: <9105152020.AA15174@theory.TN.CORNELL.EDU> Date: 15 May 91 21:04:29 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 67 X-Unparsable-Date: Wed, 15 May 91 16:39:07 BRA Dear netters, I have tried to use channels of protocol ANY in a very particular situation and my results were very strange. I use ANY channels so that one process can send various items of different types of data to another process that will route the message and save one copy of it. This latter process must see this message as an array of bytes and forward it to the apropriate receiver as another array of bytes. Upon receiving this message the receiver would break the array of bytes into pieces corresponding to the same types sent by the first process. In occam part of this would correspond to (sorry, I can't use square brackets in my terminal, I'll use parenthesis instead) the following code: Obs: the channel is global and declared as CHAN OF ANY; all messages are made of a header and a text of variable size Process 1 : REAL32 r: INT i, s, h1, h2: BOOL b: REAL64 x: SEQ r := 1.5 (REAL32) i := 1 b := TRUE x := 3.1516 (REAL64) s :=17 -- size of message text in bytes h1, h2 := 0, 0 to.p2 ! h1; h2; s; r; i; b; x Process 2: INT h1, h2, i, s: (100)BYTE buffer: SEQ to.p2 ? h1; h2; s::buffer Placing STOPs here and there I have observed that Process 1 finishes and so it sends the message successfully. But what I'm trying to explain is why Process 2 never finishes. I have some wild guesses such as: the code the compiler generates for the input command in 2, is not appropriate to receive the message text (s::buffer) because the channel to.p2 was declared as CHAN OF ANY and not CHAN OF INT; INT; INT::()INT. Another one is that I may be experiencing some alignment problem due to retyping conversions. If someone knows why this happens or how I could send one message of varying length with any number of items of any type to a process that will see this message as a well defined header plus a text defined as an array of bytes of varying length, please let me know as soon as possible. I'm using this in the project of simulation kernel and I have to provide an elegant, flexible and easy to use interface between the simulator and the user's logical processes. Thank you all. ------------------------------------------------------------------------ Luiz Felipe Perrone MSc student - COPPE - Dept. of Systems Engineering and Computer Science Universidade Federal do Rio de Janeiro - Brazil E-mail: COS99284@UFRJ (BITNET) Mailing address: Rua Senador Vergueiro 157/305 Flamengo - Rio de Janeiro, RJ - Brazil CEP 22230 Phone number: (55)-(21)-5519063 ------------------------------------------------------------------------