cpp-memclient.cpp
来自「ace开发环境 用来开发网络程序 其运用了设计模式、多平台、C++等多种知识」· C++ 代码 · 共 54 行
CPP
54 行
// $Id: CPP-memclient.cpp 78962 2007-07-20 03:27:14Z sowayaa $// 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/OS_NS_string.h"#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"ACE_RCSID(SOCK_SAP, CPP_inclient, "$Id: CPP-memclient.cpp 78962 2007-07-20 03:27:14Z sowayaa $")static intrun_client (void){ ACE_MEM_Connector connector; ACE_MEM_Stream stream; ACE_MEM_Addr server_addr (ACE_DEFAULT_SERVER_PORT); if (connector.connect (stream, server_addr.get_remote_addr ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("connect")), -1); char buf [MAXPATHLEN]; while (ACE_OS::fgets (buf, MAXPATHLEN, stdin) >0) { stream.send (buf, ACE_OS::strlen (buf)+1); stream.recv (buf, MAXPATHLEN); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Echo: %C\n"), buf)); } return 0;}int ACE_TMAIN (int argc, ACE_TCHAR *argv[]){ ACE_UNUSED_ARG(argc); // Initialize the logger. ACE_LOG_MSG->open (argv[0]); // Run the client run_client (); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?