diff options
Diffstat (limited to 'docs/tutorials/019/page03.html')
-rw-r--r-- | docs/tutorials/019/page03.html | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/docs/tutorials/019/page03.html b/docs/tutorials/019/page03.html deleted file mode 100644 index 5b35f19c8dd..00000000000 --- a/docs/tutorials/019/page03.html +++ /dev/null @@ -1,97 +0,0 @@ -<!-- $Id$ --> -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="James CE Johnson"> - <TITLE>ACE Tutorial 019</TITLE> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 019</FONT></B></CENTER> - -<CENTER><B><FONT SIZE=+2>Sharing your Memories</FONT></B></CENTER> - -<P> -<HR WIDTH="100%"> -The client app looks much like the server. We could have included the -CREATE flag with no ill effects but note the use of close() instead of -remove(). Picking the correct detachment method is rather important! -<HR> -<PRE> -<font color=red>// $Id$</font> - -<font color=red>// Again, the common stuff</font> -<font color=blue>#include</font> "<font color=green>shmem.h</font>" - -<font color=blue>#if defined</font>(<font color=purple>ACE_LACKS_SYSV_SHMEM</font>) -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "<font color=green>System V Shared Memory not available on this platform\n</font>"), - 100); -} -#else <font color=red>// ACE_LACKS_SYSV_SHMEM</font> -int -main (int, char *[]) -{ - <font color=red>/* - Attach ourselves to the shared memory segment. - */</font> - ACE_Shared_Memory_SV shm_client (SHM_KEY, SHMSZ); - - <font color=red>/* - Get our reference to the segment... - */</font> - char *shm = (char *) shm_client.malloc (); - - <font color=red>/* - If the segment identified by SHM_KEY didn't exist then we'll - get back a 0 from malloc(). You should do this check even - if you include the CREATE flag 'cause you never know when it - might fail. - */</font> - if (shm == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "<font color=green>(%P|%t) Could not get the segment!\n</font>"), - 100); - - <font color=red>/* - Does this match what your server said? - */</font> - ACE_DEBUG ((LM_INFO, - "<font color=green>(%P|%t) Shared Memory is at 0x%x\n</font>", - shm )); - - <font color=red>/* - Show the shared data to the user and convert it all to - uppper-case along the way. - */</font> - for (char *s = shm; *s != '\0'; s++) - { - putchar (*s); - *s = toupper(*s); - } - - putchar ('\n'); - - <font color=red>/* - Flag the server that we're done. - */</font> - *shm = '*'; - - <font color=red>/* - Here, we use close() instead of remove(). Remember, that - will just remove our attachment to the segment. Look - closely at the 'nattch' column of the ipcs output & you'll - see that this decrements it by one. - */</font> - shm_client.close(); - - return 0; -} - -<font color=blue>#endif</font> <font color=red>/* ACE_LACKS_SYSV_SHMEM */</font> -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page04.html">Continue This Tutorial</A>]</CENTER> |