diff options
Diffstat (limited to 'examples/IPC_SAP')
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp | 56 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp | 70 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP_memclient.dsp | 104 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/CPP_memserver.dsp | 69 | ||||
-rw-r--r-- | examples/IPC_SAP/SOCK_SAP/SOCK_SAP.dsw | 24 |
5 files changed, 323 insertions, 0 deletions
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp new file mode 100644 index 00000000000..37182fd2c38 --- /dev/null +++ b/examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp @@ -0,0 +1,56 @@ +// $Id$ + +// This tests the features of the <ACE_MEM_Connector> and +// <ACE_MEM_Stream> classes. In addition, it can be used to test the +// oneway and twoway latency and throughput at the socket-level. This +// is useful as a baseline to compare against ORB-level performance +// for the same types of data. + +#include "ace/MEM_Connector.h" +#include "ace/INET_Addr.h" +#include "ace/Thread_Manager.h" +#include "ace/Singleton.h" +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" +#include "ace/Synch.h" + +ACE_RCSID(SOCK_SAP, CPP_inclient, "$Id$") + +static int +run_client (void) +{ + ACE_MEM_Connector connector; + ACE_MEM_Stream stream; + ACE_INET_Addr server_addr (ACE_DEFAULT_SERVER_PORT, "COYOTE"); + + if (connector.connect (stream, server_addr) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), -1); + + char buf [MAXPATHLEN]; + while (gets (buf) >0) + { + stream.send (buf, ACE_OS::strlen (buf)+1); + stream.recv (buf, MAXPATHLEN); + ACE_DEBUG ((LM_DEBUG, "Echo: %s\n", buf)); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + // Initialize the logger. + ACE_LOG_MSG->open (argv[0]); + + // Run the client + run_client (); + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Singleton<Options, ACE_SYNCH_RECURSIVE_MUTEX>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Singleton<Options, ACE_SYNCH_RECURSIVE_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp b/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp new file mode 100644 index 00000000000..0dcf1c29cbc --- /dev/null +++ b/examples/IPC_SAP/SOCK_SAP/CPP-memserver.cpp @@ -0,0 +1,70 @@ +// $Id$ + +// This example tests the features of the <ACE_MEM_Acceptor>, +// <ACE_MEM_Stream>, and <ACE_Svc_Handler> classes. If the platform +// supports threads it uses a thread-per-connection concurrency model. +// Otherwise, it uses a single-threaded iterative server model. + +#include "ace/MEM_Acceptor.h" +#include "ace/Thread_Manager.h" +#include "ace/Handle_Set.h" +#include "ace/Profile_Timer.h" + +ACE_RCSID(SOCK_SAP, CPP_inserver, "$Id$") + +static int +run_event_loop (u_short port) +{ + // Create the acceptors. + ACE_MEM_Acceptor acceptor; + + ACE_MEM_Addr server_addr (port); + + // Create acceptors, reuse the address. + if (acceptor.open (server_addr, 1) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "open"), + 1); + else if (acceptor.get_local_addr (server_addr) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "get_local_addr"), + 1); + + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) starting server at port %d\n", + server_addr.get_port_number ())); + + // Keep these objects out here to prevent excessive constructor + // calls within the loop. + ACE_MEM_Stream new_stream; + + // blocking wait on accept. + if (acceptor.accept (new_stream) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "accept"), + -1); + + char buf[MAXPATHLEN]; + int len = 0; + while ((len = new_stream.recv (buf, MAXPATHLEN)) != -1) + { + ACE_DEBUG ((LM_DEBUG, "%s\n", buf)); + new_stream.send (buf, len); + } + + return new_stream.remove (); +} + +int +main (int argc, char *argv[]) +{ + u_short port = ACE_DEFAULT_SERVER_PORT; + + if (argc > 1) + port = ACE_OS::atoi (argv[1]); + + return run_event_loop (port); +} diff --git a/examples/IPC_SAP/SOCK_SAP/CPP_memclient.dsp b/examples/IPC_SAP/SOCK_SAP/CPP_memclient.dsp new file mode 100644 index 00000000000..1bb3dd35869 --- /dev/null +++ b/examples/IPC_SAP/SOCK_SAP/CPP_memclient.dsp @@ -0,0 +1,104 @@ +# Microsoft Developer Studio Project File - Name="CPP_memclient" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=CPP_memclient - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CPP_memclient.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CPP_memclient.mak" CFG="CPP_memclient - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CPP_memclient - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "CPP_memclient - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CPP_memclient - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "CPP_memclient - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CPP_memclient___Win32_Debug"
+# PROP BASE Intermediate_Dir "CPP_memclient___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "CPP_memclient - Win32 Release"
+# Name "CPP_memclient - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=".\CPP-memclient.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=".\CPP-memclient.h"
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/IPC_SAP/SOCK_SAP/CPP_memserver.dsp b/examples/IPC_SAP/SOCK_SAP/CPP_memserver.dsp new file mode 100644 index 00000000000..9fa6802ae4d --- /dev/null +++ b/examples/IPC_SAP/SOCK_SAP/CPP_memserver.dsp @@ -0,0 +1,69 @@ +# Microsoft Developer Studio Project File - Name="CPP_memserver" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=CPP_memserver - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CPP_memserver.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CPP_memserver.mak" CFG="CPP_memserver - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CPP_memserver - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CPP_memserver___Win32_Debug"
+# PROP BASE Intermediate_Dir "CPP_memserver___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
+# Begin Target
+
+# Name "CPP_memserver - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=".\CPP-memserver.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/examples/IPC_SAP/SOCK_SAP/SOCK_SAP.dsw b/examples/IPC_SAP/SOCK_SAP/SOCK_SAP.dsw index ecfbf538184..36a90951e36 100644 --- a/examples/IPC_SAP/SOCK_SAP/SOCK_SAP.dsw +++ b/examples/IPC_SAP/SOCK_SAP/SOCK_SAP.dsw @@ -27,6 +27,30 @@ Package=<4> ###############################################################################
+Project: "CPP_memclient"=.\CPP_memclient.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "CPP_memserver"=.\CPP_memserver.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "C_inclient"=.\SOCK_SAP.dsp - Package Owner=<4>
Package=<5>
|