??xml version="1.0" encoding="utf-8" standalone="yes"?>国产一区二区三区的电影,欧美精品v日韩精品v韩国精品v,欧美日韩中文在线观看http://www.shnenglu.com/mooyee/zh-cnSat, 23 Aug 2025 23:35:52 GMTSat, 23 Aug 2025 23:35:52 GMT60ACE链接p|一?/title><link>http://www.shnenglu.com/mooyee/archive/2006/03/29/4708.html</link><dc:creator>stone</dc:creator><author>stone</author><pubDate>Wed, 29 Mar 2006 01:49:00 GMT</pubDate><guid>http://www.shnenglu.com/mooyee/archive/2006/03/29/4708.html</guid><wfw:comment>http://www.shnenglu.com/mooyee/comments/4708.html</wfw:comment><comments>http://www.shnenglu.com/mooyee/archive/2006/03/29/4708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/mooyee/comments/commentRss/4708.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mooyee/services/trackbacks/4708.html</trackback:ping><description><![CDATA[有网友问?他在链接的时?产生一堆错?br /><br />我们q是先看他的代码?<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> acetest2.cpp : Defines the entry point for the console application.<br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> client.cpp</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_main.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_string.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_sys_socket.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_unistd.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_stdlib.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_stdio.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/OS_NS_netdb.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace/Default_Constants.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />ACE_RCSID(SOCK_SAP, client, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">client.cpp,v 4.10 2005/01/21 02:19:20 ossama Exp</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img id="Codehighlighter1_414_436_Open_Image" onclick="this.style.display='none'; Codehighlighter1_414_436_Open_Text.style.display='none'; Codehighlighter1_414_436_Closed_Image.style.display='inline'; Codehighlighter1_414_436_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_414_436_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_414_436_Closed_Text.style.display='none'; Codehighlighter1_414_436_Open_Image.style.display='inline'; Codehighlighter1_414_436_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_414_436_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span><span id="Codehighlighter1_414_436_Open_Text"><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"> BSD socket client </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />ACE_TMAIN (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, ACE_TCHAR </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">argv[])<br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img id="Codehighlighter1_483_2830_Open_Image" onclick="this.style.display='none'; Codehighlighter1_483_2830_Open_Text.style.display='none'; Codehighlighter1_483_2830_Closed_Image.style.display='inline'; Codehighlighter1_483_2830_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_483_2830_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_483_2830_Closed_Text.style.display='none'; Codehighlighter1_483_2830_Open_Image.style.display='inline'; Codehighlighter1_483_2830_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_483_2830_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_483_2830_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Initialize WinSock DLL on Win32<img src="http://www.shnenglu.com/images/dot.gif" /></span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  ACE_OS::socket_init (ACE_WSOCK_VERSION);<br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000"> sockaddr_in saddr;<br /></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000"> hostent </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">hp;<br /></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> ACE_TCHAR </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">host </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> argc </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">?</span><span style="COLOR: #000000"> argv[</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">] : ACE_DEFAULT_SERVER_HOST;<br /></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  u_short port_num </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    htons (argc </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">?</span><span style="COLOR: #000000"> ACE_OS::atoi (argv[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">]) : ACE_DEFAULT_SERVER_PORT);<br /></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> sockbufsize </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> argc </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">3</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">?</span><span style="COLOR: #000000"> ACE_OS::atoi (argv[</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">]) : </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> buf[BUFSIZ];<br /></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  ACE_HANDLE s_handle;<br /></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> w_bytes;<br /></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> r_bytes;<br /></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n;<br /></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Create a local endpoint of communication.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">38</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> ((s_handle </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ACE_OS::socket (PF_INET, SOCK_STREAM, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> ACE_INVALID_HANDLE)<br /></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">socket</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> If a sockbufsize was specified, set it for both send and receive.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">42</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (sockbufsize </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img id="Codehighlighter1_1213_1605_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1213_1605_Open_Text.style.display='none'; Codehighlighter1_1213_1605_Closed_Image.style.display='inline'; Codehighlighter1_1213_1605_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1213_1605_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1213_1605_Closed_Text.style.display='none'; Codehighlighter1_1213_1605_Open_Image.style.display='inline'; Codehighlighter1_1213_1605_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_1213_1605_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_1213_1605_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (ACE_OS::setsockopt (s_handle, SOL_SOCKET, SO_SNDBUF,<br /></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      (</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">sockbufsize,<br /></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000"> (sockbufsize)) </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">SO_SNDBUF</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (ACE_OS::setsockopt (s_handle, SOL_SOCKET, SO_RCVBUF,<br /></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      (</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">sockbufsize,<br /></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000"> (sockbufsize)) </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">SO_RCVBUF</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Determine IP address of the server.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">55</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> ((hp </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR(host))) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">gethostbyname</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Set up the address information to contact the server.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">59</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  ACE_OS::memset ((</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">saddr, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000"> saddr);<br /></span><span style="COLOR: #008080">60</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  saddr.sin_family </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> AF_INET;<br /></span><span style="COLOR: #008080">61</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  saddr.sin_port </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> port_num;<br /></span><span style="COLOR: #008080">62</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  ACE_OS::memcpy (</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">saddr.sin_addr, hp</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">h_addr, hp</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">h_length);<br /></span><span style="COLOR: #008080">63</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">64</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Establish connection with remote server.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">65</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (ACE_OS::connect (s_handle,<br /></span><span style="COLOR: #008080">66</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    reinterpret_cast</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">sockaddr </span><span style="COLOR: #000000">*></span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">saddr),<br /></span><span style="COLOR: #008080">67</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000"> saddr) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">68</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">connect</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">69</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">70</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Send data to server (correctly handles "incomplete writes" due to<br /></span><span style="COLOR: #008080">71</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> flow control).</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">72</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">73</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> ((r_bytes </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ACE_OS::read (ACE_STDIN, buf, </span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000"> buf)) </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">74</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (w_bytes </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; w_bytes </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> r_bytes; w_bytes </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> n)<br /></span><span style="COLOR: #008080">75</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> ((n </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ACE_OS::send (s_handle, buf </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> w_bytes,<br /></span><span style="COLOR: #008080">76</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />        r_bytes </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> w_bytes)) </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">77</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />        ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">write</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">78</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">79</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (ACE_OS::recv (s_handle, buf, </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">80</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    ACE_OS::write (ACE_STDOUT, buf, </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">81</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">82</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Explicitly close the connection.</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">83</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (ACE_OS::closesocket (s_handle) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">84</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />    ACE_OS::perror (ACE_TEXT(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">close</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)), ACE_OS::exit (</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">85</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">86</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">87</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">88</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">89</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span></div><br />直接~译,产生如下错误<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">------</span><span style="COLOR: #000000"> Build started: Project: acetest2, Configuration: Debug Win32 </span><span style="COLOR: #000000">------</span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />Compiling<img src="http://www.shnenglu.com/images/dot.gif" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.cpp<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />Linking<img src="http://www.shnenglu.com/images/dot.gif" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ace_os_main_i(class ACE_Main_Base &,int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_os_main_i@@YAHAAVACE_Main_Base@@HQAPAD@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function _main<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) public: __thiscall ACE_Main_Base::ACE_Main_Base(void)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">??</span><span style="COLOR: #000000">0ACE_Main_Base@@QAE@XZ) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">public: __thiscall ACE_Main::ACE_Main(void)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">??</span><span style="COLOR: #000000">0ACE_Main@@QAE@XZ)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::closesocket(void *)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">closesocket@ACE_OS@@YAHPAX@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::write(void *,void const *,unsigned int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">write@ACE_OS@@YAHPAXPBXI@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::recv(void *,char *,unsigned int,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">recv@ACE_OS@@YAHPAXPADIH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::send(void *,char const *,unsigned int,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">send@ACE_OS@@YAHPAXPBDIH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::read(void *,void *,unsigned int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">read@ACE_OS@@YAHPAX0I@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::connect(void *,struct sockaddr *,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">connect@ACE_OS@@YAHPAXPAUsockaddr@@H@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) void * __cdecl ACE_OS::memcpy(void *,void const *,unsigned int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">memcpy@ACE_OS@@YAPAXPAXPBXI@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) void * __cdecl ACE_OS::memset(void *,int,unsigned int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">memset@ACE_OS@@YAPAXPAXHI@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) struct hostent * __cdecl ACE_OS::gethostbyname(char const *)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">gethostbyname@ACE_OS@@YAPAUhostent@@PBD@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::setsockopt(void *,int,int,char const *,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">setsockopt@ACE_OS@@YAHPAXHHPBDH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) void __cdecl ACE_OS::exit(int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">exit@ACE_OS@@YAXH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) void __cdecl ACE_OS::perror(char const *)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">perror@ACE_OS@@YAXPBD@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) void * __cdecl ACE_OS::socket(int,int,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">socket@ACE_OS@@YAPAXHHH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::atoi(char const *)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">atoi@ACE_OS@@YAHPBD@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />acetest2.obj : error LNK2019: unresolved external symbol </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">__declspec(dllimport) int __cdecl ACE_OS::socket_init(int,int)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (__imp_</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">socket_init@ACE_OS@@YAHHH@Z) referenced </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> function </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">int __cdecl ace_main_i(int,char * * const)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">ace_main_i@@YAHHQAPAD@Z)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />Debug</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">acetest2.exe : fatal error LNK1120: </span><span style="COLOR: #000000">17</span><span style="COLOR: #000000"> unresolved externals</span></div><br />解决Ҏ,是正的链接ace(x).lib<br />其中, release版对应的是ace.lib,debug对应的是aced.lib<br />同时Q还要确保编辑器能正找到ace(x).lib的位|.<br /><br />单的办法是加入下面的代码<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">#ifdef _DEBUG<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#pragma  comment (lib,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">aced.lib</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">#else</span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />#pragma  comment (lib,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ace.lib</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span></div><p><br /> </p><img src ="http://www.shnenglu.com/mooyee/aggbug/4708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mooyee/" target="_blank">stone</a> 2006-03-29 09:49 <a href="http://www.shnenglu.com/mooyee/archive/2006/03/29/4708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从实例开始谈状态图的?/title><link>http://www.shnenglu.com/mooyee/archive/2006/03/15/4205.html</link><dc:creator>stone</dc:creator><author>stone</author><pubDate>Wed, 15 Mar 2006 09:23:00 GMT</pubDate><guid>http://www.shnenglu.com/mooyee/archive/2006/03/15/4205.html</guid><wfw:comment>http://www.shnenglu.com/mooyee/comments/4205.html</wfw:comment><comments>http://www.shnenglu.com/mooyee/archive/2006/03/15/4205.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/mooyee/comments/commentRss/4205.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mooyee/services/trackbacks/4205.html</trackback:ping><description><![CDATA[<H1 style="MARGIN: 17pt 0cm 16.5pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从实例开始谈状态图的?/SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 14">                                                               2005119@gmail.com</SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">                                                              </SPAN>v1.0 <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chsdate w:st="on" Year="2006" Month="3" Day="15" IsLunarDate="False" IsROCDate="False">2006-03-15</st1:chsdate></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">摘要Q在对“靓L用”项目的重构中,我通过状态图很好的理解了业务逻辑。由此进一步归U了状态图在开发过E中的用提C和技巧?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">关键词:</SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q状态图Q重?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读者水qI初</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p> </o:p></SPAN></P> <H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">引言</SPAN></H2> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 15.75pt; mso-char-indent-count: 1.5"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“靓L用”是原无U技术部门开?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 新宋? mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">GLSMRPIDService</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 新宋? mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">中的一个部分,׃q部分存在已的功能缺P需要对之进行适当的修改,通过q种方式来功能得到完善q版本得到演进。我先给出当前需求,对对象“靓号”的状态图?SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 新宋? mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><o:p> </o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 15.75pt; mso-char-indent-count: 1.5"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按图说图图(</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q描qC对象“靓号”在其生命期中的几个状态,“靓号”能被锁定,被锁定的“靓号”不能被其它用户再锁定。被锁定的靓号如果在</SPAN><SPAN lang=EN-US>15</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分钟内没被用L用,则还回到初始状态,可以再被Q其他)用户锁定。被锁定的“靓号”可以被U用Q租用到期后能被pȝ预留Q即为先前的用户保护hQ,预留一个月后如用户未箋U,则此“靓号”可以被其他人锁定或U用。在U用状态下的“靓号”,如果被同一用户累积U用过半年Q则可以买断。被买断后,此“靓号”变成普通号?BR></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 新宋? mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P> <H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial"><IMG alt="" hspace=0 src="C:\Documents and Settings\jiangtao\桌面\dgm4417ba24001f.png" align=baseline border=0></SPAN></H2> <H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">概念</SPAN></H2> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 26.25pt; mso-char-indent-count: 2.5"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">很遗憾,原设计由于所面对的问题领域规模小Q所以ƈ没有采用</SPAN><SPAN lang=EN-US>OOD/OOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方式,所以看不到<B style="mso-bidi-font-weight: normal">c?/B></SPAN><SPAN lang=EN-US><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shape id=_x0000_i1026 style="WIDTH: 124.5pt; HEIGHT: 30.75pt" type="#_x0000_t75"> <v:imagedata o:title="" src="file:///C:\DOCUME~1\jiangtao\LOCALS~1\Temp\msohtml1\01\clip_image003.emz"></v:imagedata></v:shape><B style="mso-bidi-font-weight: normal">CCoolIdentity</B></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q样的实体类Q但׃问题领域所处理的对象即为“靓号”,因此Q这里先引入q个cR这里,插入状态图使用的第一个准则:</SPAN></P> <TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN: auto auto auto 32.4pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellSpacing=0 cellPadding=0 border=1> <TBODY> <TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"> <TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 393.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt" vAlign=top width=525> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">准则</SPAN><SPAN lang=EN-US>1: </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图只对单一对象的复杂行行模建。这里的对象指类、角艌Ӏ子pȝ、或lg?/SPAN></P></TD></TR></TBODY></TABLE> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">因此Q状态图q不为多个对象之间的行ؓ建模。多个对象之间的行ؓ建模参考“活动图”,“时序图”,对象之间的关pd考“类䏀,“对象图”以及参考设计模?/SPAN><SPAN lang=EN-US>(</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设计模式通常?/SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>Booch</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图表C类之间的关p?/SPAN><SPAN lang=EN-US>, Booch</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的前w?/SPAN><SPAN lang=EN-US>)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。现在我们给出状态图的定义?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">    </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图Q全UCؓ状态机视图</SPAN><SPAN lang=EN-US>(state machine view)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q通过Ҏ个类的生个对象Ş字的生命期徏模,描述了对象在旉上的动态行为?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体">状态图</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于Ҏ型元素的动态行行徏模,更具体地_是对系l行Z受事仉动的斚wq行建模?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">   </SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图q态组成,各状态由转移链接在一赗状态是对象执行某项zd或等待某个事件时的条件。{UL两个状态之间的关系Q它由某个事件触发,然后执行特定的操作或评估q导致特定的l束状态。图</SPAN> <SPAN lang=EN-US>(2) </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">描绘了状态图的各U元素?/SPAN></P> <TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellSpacing=0 cellPadding=0 border=1> <TBODY> <TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"> <TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 426.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt" vAlign=top width=568> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>?<IMG height=278 alt=md_state1.gif src="http://www.shnenglu.com/images/cppblog_com/mooyee/md_state1.gif" width=511 border=0></SPAN></P></TD></TR></TBODY></TABLE> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">态是对象执行某项zd或等待某个事件时的条件。对象可能会在有限的旉长度内保持某一状态。状态具有以下几特征:</SPAN></P> <DIV align=center> <TABLE class=MsoNormalTable style="BORDER-RIGHT: gray 1pt solid; BORDER-TOP: gray 1pt solid; MARGIN: auto auto auto 37.3pt; BORDER-LEFT: gray 1pt solid; WIDTH: 429.2pt; BORDER-BOTTOM: gray 1pt solid; mso-border-alt: solid gray .75pt; mso-padding-alt: 1.5pt 1.5pt 1.5pt 1.5pt; mso-cellspacing: 0cm" cellSpacing=0 cellPadding=0 width=572 border=1> <TBODY> <TR style="HEIGHT: 18.75pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 140.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=187> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">名称</SPAN></P></TD> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 289.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=385> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个状态与其他状态区分开来的文本字符Ԍ状态也可能是匿名的Q这表示它没有名U?/SPAN></P></TD></TR> <TR style="HEIGHT: 18.75pt; mso-yfti-irow: 1"> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 140.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=187> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 3pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">q入</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">/</SPAN></B><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">退出操?/SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 289.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=385> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在进入和退出状态时所执行的操作?/SPAN></P></TD></TR> <TR style="HEIGHT: 18.75pt; mso-yfti-irow: 2"> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 140.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=187> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 3pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">内部转移</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 289.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=385> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在不使状态发生变更的情况下进行的转移?/SPAN></P></TD></TR> <TR style="HEIGHT: 18.75pt; mso-yfti-irow: 3"> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 140.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=187> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 3pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">子状?/SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 289.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=385> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态的嵌套l构Q包括不相连的(依次处于zd状态的Q或q行的(同时处于zd状态的Q子状态?/SPAN></P></TD></TR> <TR style="HEIGHT: 18.75pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes"> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 140.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=187> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 3pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">延迟的事?/SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD> <TD style="BORDER-RIGHT: gray 1pt inset; PADDING-RIGHT: 1.5pt; BORDER-TOP: gray 1pt inset; PADDING-LEFT: 1.5pt; PADDING-BOTTOM: 1.5pt; BORDER-LEFT: gray 1pt inset; WIDTH: 289.1pt; PADDING-TOP: 1.5pt; BORDER-BOTTOM: gray 1pt inset; HEIGHT: 18.75pt; BACKGROUND-COLOR: transparent; mso-border-alt: inset gray .75pt" vAlign=top width=385> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">未在该状态中处理但被延迟处理Q即列队{待由另一个状态中的对象来处理Q的一pd事g?/SPAN></P></TD></TR></TBODY></TABLE></DIV> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如图</SPAN> <SPAN lang=EN-US>(2) </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所C,可以为对象的状态图定义两种Ҏ的状态。初始状态指C状态图或子状态的默认起始位置?/SPAN></P> <H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">何时需要状态图</SPAN></H2> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在实际的目开发中Qƈ不是Ҏ一个类都画状态图。何旉要状态图Q我们可以采用下面的原则来确定:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">敏捷建模</SPAN><SPAN lang=EN-US>( AM) ( Ambler 2002)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的原则-Q最大化目q系人的投资Q-你只有当模型能够提供正面价值的时候才创徏模型?/SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果一个实体,比如一个类或组Ӟ表示的行为的序和当前的状态无养I那么M?/SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图可能是没有什么用处的。例如一?/SPAN><SPAN lang=EN-US>CLogFile</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">cd很简单,表示了那些你会在系l中记录一操作的数据,因此一?/SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图没有Q何相关之处。而“靓号”这cd象就l比较的复杂?/SPAN></P> <H2 style="MARGIN: 13pt 0cm"><A name=Hints_and_Tips><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">提示与技?/SPAN></A></H2> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当给定一w择Ӟ要用状态图的可视语义,而不要写l的转移代码。例如,不要用几个信可发一个{U,然后使用详细代码来管理以不同的方式依赖于信号的控制流。应使用由单独的信号来触发的单独转移。在隐藏了附加行为的转移代码中,要避免用条仉辑?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Ҏ在状态期间等待的事g或正在发生的事g来命名状态。记住,状态不是“时间点”;它是状态图{待某个事g发生的时间段。例如,?/SPAN><SPAN lang=EN-US>waitingForEnd</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”这一名称比?/SPAN><SPAN lang=EN-US>end</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”更好;?/SPAN><SPAN lang=EN-US>timingSomeActivity</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”比?/SPAN><SPAN lang=EN-US>timeout</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”更好。不要让状态的名称看v来象是操作名?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在一个状态图内唯一地命名所有状态和转移Q这便于进行源U别的调试?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">谨慎使用状态变量;不要在创建新状态时使用它们。如果状态不多,很少带有或不带有依赖于状态的行ؓQƈ且很有或根本没有可能与包含状态图的封装体q行或独立的行ؓQ就可以使用状态变量。如果有复杂的、依赖于状态的潜在q行行ؓQ或者如果必d理的事g可能来自于包含状态图的封装体之外Q则应考虑使用构g装体?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果单个图中的状态超q?/SPAN><SPAN lang=EN-US> 5 * 2 </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个,应考虑使用子状态。在q里可以应用我们的常识:在一个非常规则的模式中可以有十个状态,但如果两个状态之间具有四十个转移Q显然就需要重新考虑了。务必要使状态图易于理解?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用触发事g的事件和</SPAN><SPAN lang=EN-US>/</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或在转移期间发生的事件ؓ转移命名。选择更加易于理解的名U?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当您看见一个选择ҎQ应考虑是否可以作选择的职责委托给另一个构Ӟ以便其作ؓ一l将不同的信h供给装体遵照执行(例如Q代替对消息</SPAN><SPAN lang=EN-US>-></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据</SPAN><SPAN lang=EN-US> > x </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的选择Q,q考虑是否可以让发送方或另一中间主角来作出决定,然后通过在信号名UC明确昄该决定的方式发送信P例如Q用名?/SPAN><SPAN lang=EN-US> isFull </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US> isEmpty </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的信P而不是以值命名信号ƈ查消息数据)?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为在选择点中回答的问题指定描q性的名称Q例如?/SPAN><SPAN lang=EN-US>isThereStillLife</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”或?/SPAN><SPAN lang=EN-US>isItTimeToComplain</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在Q何给定的装体中Q尽量选择点名UC持唯一Q其原因与{UdU需保持唯一相同Q?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">转移的代码段是否太长Q是否应使用函数来代替它们,是否常用代码段记录为函敎ͼ转移应该cM于高层的伪代码,q且应当遵@?/SPAN><SPAN lang=EN-US> C++ </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数相同或更严格的长度规则。例如,代码过</SPAN><SPAN lang=EN-US> 25 </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">行的转移可被认ؓ是过ѝ?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应根据函数执行的操作来命名函数?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要特别注意进入和退出操作:在进行更改后忘记更改相应q入和退出操作的情况其Ҏ发生?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">退出操作可用于提供安全性功能,例如Q从?/SPAN><SPAN lang=EN-US>heaterOn</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”状态中的退出操作将关闭加热器,在这里,操作被用来强制执行一个断a语句?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通常Q除非状态图是抽象的q且由包含元素的子cLq行改进Q否则子状态应包含两个或更多个状态?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应该用选择Ҏ代替操作或{UM的条仉辑。选择点容易被看到Q而代码中的条仉辑则是不可见的Q很Ҏ被忽略?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">避免使用警戒条g?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果事g触发了几个{U,无法控刉先对哪个警戒条g求倹{这会生无法预料的l果?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可能有多个警戒条件ؓ?/SPAN><SPAN lang=EN-US>True</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”,但随后只能有一个{UR所选择的\径是无法预料的?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">警戒条g是不可见的;要“看见”它们的出现更是困难?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">避免使用cM程囄状态图?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q可能表C您试图对ƈ不实际存在的抽象概念q行建模Q例如:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用一个封装体来对最适合于数据类的行行徏模,?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通过使用紧密耦合的数据类和封装体cLҎ据类建模Q例如,数据cȝ于向四周传递类型信息,但封装体cd含了应与数据cȝ兌的大部分数据Q?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态图的这U错误用法可以通过以下故障现象来识别:</SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被发送给“自己”的消息Q主要是Z重复使用代码</SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">几乎没有状态,但有很多选择?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在某些情况下没有循环的状态图。在程控制应用E序中,或者在试图控制一个事件序列时Q这L状态图是有效的Q如果它们在分析q程中出玎ͼ则表C状态图已退化ؓ程图?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当发现问题时Q应采取以下措施Q?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">考虑封装体分解责更明确的小单元Q?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">更多的行ؓ转移C有问题的装体相兌的数据类中?/SPAN><SPAN lang=EN-US> </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">更多的行ؓ转移到封装体cdC?/SPAN> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: -21pt; mso-list: l0 level3 lfo1; tab-stops: list 63.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">u<SPAN style="FONT: 7pt 'Times New Roman'">       </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">制作更有意义的信P以避免对数据的依赖?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">避免</SPAN><SPAN lang=EN-US>"</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">黑洞</SPAN><SPAN lang=EN-US>"</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">黑洞状态是那种只有变换q来但没有Q何变换发出的状态,q种情况要么׃该状态是一个最l状态,要么是你已l错q了一个或多个变换变换?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">l<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">避免</SPAN><SPAN lang=EN-US>"</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">奇迹</SPAN><SPAN lang=EN-US>"</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level2 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN style="mso-list: Ignore">n<SPAN style="FONT: 7pt 'Times New Roman'">         </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">奇迹状态是那种只有变换发出但没有Q何变换进来的状态,q种情况要么׃该状态是一个v点,要么是你已l错q了一个或多个变换变换?/SPAN></P> <H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">参考文?/SPAN></H2> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">       </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>UML</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用户手册?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">     </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>Rational Unified Process</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">     </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其它|络资源</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p> </o:p></SPAN></P><img src ="http://www.shnenglu.com/mooyee/aggbug/4205.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mooyee/" target="_blank">stone</a> 2006-03-15 17:23 <a href="http://www.shnenglu.com/mooyee/archive/2006/03/15/4205.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ACE_Message_Block知?/title><link>http://www.shnenglu.com/mooyee/archive/2006/03/15/4197.html</link><dc:creator>stone</dc:creator><author>stone</author><pubDate>Wed, 15 Mar 2006 05:53:00 GMT</pubDate><guid>http://www.shnenglu.com/mooyee/archive/2006/03/15/4197.html</guid><wfw:comment>http://www.shnenglu.com/mooyee/comments/4197.html</wfw:comment><comments>http://www.shnenglu.com/mooyee/archive/2006/03/15/4197.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/mooyee/comments/commentRss/4197.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mooyee/services/trackbacks/4197.html</trackback:ping><description><![CDATA[<TABLE class="fixedTable blogpost" cellSpacing=0 width="100%" border=0> <TBODY> <TR> <TD class=ellipse><span id="4ku848i" class=bvTitle id=subjcns!A4A8B7175059E42A!273><STRONG>ACE_Message_Block知?/STRONG></SPAN></TD></TR> <TR> <TD class=bvh8><STRONG></STRONG></TD></TR> <TR> <TD id=msgcns!A4A8B7175059E42A!273> <DIV>1 copy() 不需要让写指针后U? <BR>  ACE_Message_Block* mb = new ACE_Message_Block(BUFSIZ);<BR>  mb->copy(buff); //buff先已l初始化</DIV> <DIV>2 初始化mb后需要后UL针的情况<BR>  2.1 <BR>  ACE_Message_Block* mb = new ACE_Message_Block(buff,len);<BR>  mb->wt_ptr(len);  //len是buff的长?len = strlen(buff) +1<BR>                    // +1 表示后面的\0</DIV> <DIV>  2.2<BR>  ACE_Message_Block* mb = new ACE_Message_Block(BUFSIZ);<BR>  ACE_OS::sprintf(mb->wt_ptr(),buff);<BR>  mb->wt_ptr(len); </DIV> <DIV>  2.3<BR>  ACE_Message_Block* mb = new ACE_Message_Block(len,<BR>            ACE_Message_Block::MB_DATA,<BR>            mb2,   //表示 mb->cont(mb2)<BR>            buff)<BR>  mb->wt_ptr(len);</DIV> <DIV>3.让消息接成串cont()?千万不要直接或接间的把它接成一个环<BR>   mb->cont(mb2);<BR>   mb2->cont(mb3); //ok<BR>   ***mb3->cont(mb);  //d?/DIV> <DIV>4.通知其它U程l束?可以通过ACE_Message_Block::MB_STOP<BR>  <BR>  ACE_Message_Block* lastMsg =ACE_Message_Block ,ACE_Message_Block::MB_STOP)</DIV> <DIV>  otherTask->putq(lastMsg);</DIV> <DIV><BR>  otherTask在接收到的时候如下处?BR> <BR>   <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> OtherTask::svc()<BR>   {<BR>          ACE_Message_Block</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> mb;<BR>           </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">)<BR>           { <BR>             getq(mb);<BR>            </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(mb</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">get_tpye() </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> ACE_Message_Block::MB_STOP)<BR>           {<BR>              mb</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">release();<BR>              </SPAN><SPAN style="COLOR: #0000ff">break</SPAN><SPAN style="COLOR: #000000">; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">退个永久限?</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">           }<BR>           </SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>           {<BR>              handle_message(mb); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">处理q条消息</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">             }<BR>         } </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> end while</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"> <BR>     </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>          <BR>    }<BR></SPAN></DIV><SPAN id=Codehighlighter1_24_387_Open_Text></SPAN></DIV></TD></TR></TBODY></TABLE><img src ="http://www.shnenglu.com/mooyee/aggbug/4197.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mooyee/" target="_blank">stone</a> 2006-03-15 13:53 <a href="http://www.shnenglu.com/mooyee/archive/2006/03/15/4197.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.ytmsw.cn" target="_blank">ۺϾþþ</a>| <a href="http://www.jbeq.cn" target="_blank">þþAVҰ</a>| <a href="http://www.yiyioo.cn" target="_blank">vaþþþ</a>| <a href="http://www.hgnulb.cn" target="_blank">ŷִִþþ</a>| <a href="http://www.loufengxinxi.cn" target="_blank">Ʒҹþ</a>| <a href="http://www.theboy.com.cn" target="_blank">þAV뾫Ʒ</a>| <a href="http://www.centralworld.cn" target="_blank">þþƷAV鶹վ</a>| <a href="http://www.ylbxpw.cn" target="_blank">ƷۺϾþ</a>| <a href="http://www.imran.com.cn" target="_blank">þ99ֻоƷ66</a>| <a href="http://www.412news.cn" target="_blank">þ99ȺݺɫƷһ</a>| <a href="http://www.sang423.cn" target="_blank">Ʒþһ </a>| <a href="http://www.sjpeixun.cn" target="_blank">vaĻþ </a>| <a href="http://www.qfzxd.cn" target="_blank">ξþ99Ʒþþþþ </a>| <a href="http://www.vbnj.cn" target="_blank">69Ʒþþþ99</a>| <a href="http://www.pewn.cn" target="_blank">һþaþþƷ</a>| <a href="http://www.3hiis.cn" target="_blank">Ůþþþþ</a>| <a href="http://www.vcdordvd.cn" target="_blank">ٸ޾þþþþ4</a>| <a href="http://www.dywanjiale.cn" target="_blank">AVþþƷ</a>| <a href="http://www.zhaopf.com.cn" target="_blank">þۺɫHEZYO</a>| <a href="http://www.nxxdz.cn" target="_blank">޳ɫ999þվ</a>| <a href="http://www.qxri.cn" target="_blank">Ʒþһ</a>| <a href="http://www.jxjkyt.cn" target="_blank">ٸлþþþ</a>| <a href="http://www.lyddcy.cn" target="_blank">պӰþþñ</a>| <a href="http://www.taokecai.cn" target="_blank">þþѹ۳ӰԺ</a>| <a href="http://www.sanbaotong.cn" target="_blank">þþþþۺһĻ</a>| <a href="http://www.rainbow-city.cn" target="_blank">þþþAVվ </a>| <a href="http://www.0795fcw.cn" target="_blank">޾Ʒþþþþ</a>| <a href="http://www.ehfad.cn" target="_blank">ŷͽxxxxѿþþ</a>| <a href="http://www.ruea.cn" target="_blank">þùƵ99Ӱ</a>| <a href="http://www.buniaowan.cn" target="_blank">þþɫۺϾɫ99</a>| <a href="http://www.9527dm.cn" target="_blank">þۺϾɫۺŷݺ</a>| <a href="http://www.macwolf.cn" target="_blank">Ůþþ</a>| <a href="http://www.51saer.cn" target="_blank">ƷþþþþþþĻ</a>| <a href="http://www.ssc959.cn" target="_blank">þþƷa޹v岻</a>| <a href="http://www.90key.cn" target="_blank">þþƷAV鶹</a>| <a href="http://www.bluecc.com.cn" target="_blank">ަvþþ</a>| <a href="http://www.mir802.cn" target="_blank">þۺϹapp</a>| <a href="http://www.gzwy9.cn" target="_blank">þۺ97ɫ</a>| <a href="http://www.masterflexpump.com.cn" target="_blank">þ޾Ʒ</a>| <a href="http://www.sme369.cn" target="_blank">ھƷþ޻</a>| <a href="http://www.izyph.cn" target="_blank">þó˾Ʒ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>