2 Copyright (c) 2000-2014 Ericsson Telecom AB
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
11 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
12 <meta http-equiv=
"Content-Language" content=
"en-us">
13 <title>receive
</title>
15 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
16 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
18 <td width=
105 height=
40><a href=
"https://projects.eclipse.org/projects/tools.titan"><img src=
"../images/titan_transparent.gif" border=
0 width=
105 height=
40 align=
"left" alt=
"Titan"></a></td>
21 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
23 <td><a href=
"../titan_main.html" alt=
"contents"><img border=
"0" src=
"../images/ao.jpg" width=
"53" height=
"40"></a></td>
24 <td><a href=
"../titan_index.html" alt=
"index"><img border=
"0" src=
"../images/up.jpg" width=
"53" height=
"40"></a></td>
25 <td><a href=
"read.html" alt=
"previous"><img border=
"0" src=
"../images/left.jpg" width=
"53" height=
"40"></a></td>
26 <td><a href=
"record.html" alt=
"next"><img border=
"0" src=
"../images/right.jpg" width=
"53" height=
"40"></a></td>
33 <hr align=
"left" width=
"75%">
34 <p>The asynchronous operation belongs to the family of message-based communication operations. It is used to receive a value from an incoming message port queue.
36 <li>The operation can be used on connected ports only.
</li>
37 <li>The operation has blocking semantics (except when used within an alt statement!) i.e., the TTCN3 program execution is halted until the message matching the criteria described in the value
39 <li>The operation examines the
1st message on the port queue but extracts this only if the message matches the receiving template
</li>
40 <li>In case of multiple connections the operation may be restricted to a certain sender.
</li>
41 <li>The received value and the address of the sender may be stored.
</li>
43 <p>Related keywords:
</p>
45 <li><a href=
"address.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">address
</font></b></a></li>
46 <li><a href=
"any.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">any
</font></b></a></li>
47 <li><a href=
"create.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">create
</font></b></a></li>
48 <li><a href=
"from.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">from
</font></b></a></li>
49 <li><a href=
"modifies.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">modifies
</font></b></a></li>
50 <li><a href=
"sender.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">sender
</font></b></a></li>
51 <li><a href=
"system.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">system
</font></b></a></li>
52 <li><a href=
"value.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">value
</font></b></a></li>
54 <hr align=
"left" width=
"50%">
57 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
60 <h3 align=
"center"><i>port_reference
</i><font face=
"Courier New" color=
"#003258" size=
"5"><b>.receive
</b></font>[
<font face=
"Courier New" color=
"#003258" size=
"5"><b> (
</b></font><i>
61 value_part
</i><font face=
"Courier New" color=
"#003258" size=
"5"><b>)
</b></font> ] [
<font face=
"Courier New" color=
"#003258" size=
"5"><b>from
</b></font><i>address_reference
</i> ] [
<font
62 face=
"Courier New" color=
"#003258" size=
"5"><b>-
> </b></font><i>assignment_part
</i> ]
<font face=
"Courier New" color=
"#003258" size=
"5"><b>;
</b></font> </h3>
70 <p><i> port_reference
</i> points out the incoming message port.
</p>
74 <p>the keywords
<b><font face=
"Courier New" color=
"#003258" size=
"4">any port
</font> </b> may be used to indicate that messages from any ports will be accepted (see the
<a href=
"#Example 7:">example
79 <p>The
<b><font face=
"Courier New" color=
"#003258" size=
"4">receive
</font> </b> keyword introduces the message reception.
</p>
82 <p><i>value_part
</i> is one of the following: (rem.: when omitted,
<a href=
"#Example 4"> any message will be received
</a>)
</p>
84 <li>a literal value, a constant, a variable, an expression. (see the
<a href=
"#Example 1">example1
</a>)
</li>
85 <li>a value template (see the
<a href=
"#Example 2">example
2</a>)
</li>
86 <li>a modified template (see the
<a href=
"#Example 3">example
3</a>)
<br>
91 <p>The optional
<b><font face=
"Courier New" color=
"#003258" size=
"4">from
</font> </b> keyword is used when a port is connected to several entities and restriction to one communication partner is
97 <p><i>address_reference
</i> is one of the following:
</p>
99 <li>a component reference (cf.
<a href=
"create.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">create
</font></b></a>)
or the keyword
<a href=
"system.html"
100 target=
"_blank"><b><font face=
"Courier New" color=
"#003258" size=
"4">system
</font></b></a>, in case of one-to-many connections.
</li>
102 <p>an address reference (cf.
<a href=
"address.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">address
</font></b></a>) , when there are several entities within the
103 system under test .
</p>
108 <p><i>assignment_part
</i> is one or both of the following:
</p>
110 <li>the
<a href=
"sender.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">sender
</font></b></a> keyword followed by a variable of
<a href=
"address.html"
111 target=
"_blank"><b><font face=
"Courier New" color=
"#003258" size=
"4">address
</font></b></a> or
<a href=
"component.html"><b><font face=
"Courier New" color=
"#003258"
112 size=
"4">component
</font></b></a> type to store the address of the sender (see the
<a href=
"#Example 5">example
5</a>).
</li>
113 <li>the
<a href=
"value.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">value
</font></b></a> keyword followed by a variable of the same type as the received message
114 to store the received value (see the
<a href=
"#Example 6:">example
6</a>).
</li>
118 <hr align=
"left" width=
"50%">
119 <p><a name=
"Example 1">Example
1</a>: literal value
120 <p><font face=
"Courier New">portibus_PCO.receive (charstring:
"abl
") from system;
</font>
121 <p>The character string abl is received over the port portibus_PCO from the test system interface. The port is connected to several components.
</p>
122 <hr align=
"left" width=
"50%">
123 <p><a name=
"Example 2">Example
2</a>: template
</p>
124 <p><font face=
"Courier New">portibus_PCO.receive (tr_MeiTemplate);
</font></p>
125 <p>The template (tr_MeiTemplate) determines what kind of messages will be received.
</p>
126 <hr align=
"left" width=
"50%">
127 <p><a name=
"Example 3">Example
3</a>: modified template
</p>
128 <p><font face=
"Courier New">portibus_PCO.receive (modifies tr_MeiTemplate := {field1 := false});
</font></p>
129 <p>The modified template (tr_MeiTemplate) determines what kind of messages will be received.
</p>
130 <hr align=
"left" width=
"50%">
131 <p><a name=
"Example 4">Example
4</a>: any message reception
</p>
132 <p><font face=
"Courier New">portibus_PCO.receive;
</font></p>
133 <p>Any message on port portibus_PCO will be accepted.
</p>
134 <hr align=
"left" width=
"50%">
135 <p><a name=
"Example 5">Example
5</a>: storing the sender address
</p>
136 <p><font face=
"Courier New">portibus_PCO.receive (tr_MeiTemplate) -
> sender v_address;
</font></p>
137 <p>The address of the sender is stored in the variable v_address.
</p>
138 <hr align=
"left" width=
"50%">
139 <p><a name=
"Example 6:">Example
6:
</a> storing the received value
</p>
140 <p><font face=
"Courier New">portibus_PCO.receive (tr_MeiTemplate) -
> value v_ReceivedMessage;
</font></p>
141 <p>The received message is saved in the variable v_ReceivedMessage.
</p>
142 <hr align=
"left" width=
"50%">
143 <p><a name=
"Example 7:">Example
7:
</a> receive on any port
</p>
144 <p><font face=
"Courier New">any port.receive (tr_MeiTemplate) -
> value v_ReceivedMessage;
</font></p>
145 <p>The message matching the template tr_MeiTemplate and received on any port is saved to the variable v_ReceivedMessage.
</p>
146 <hr align=
"left" width=
"25%">
147 <hr align=
"left" width=
"25%">
148 <p><a HREF=
"BNF.html#receivestatement">BNF definition
</a> of
<font face=
"Courier New"> receive
</font></p>