From d360daade3092325ef5f52ce3c47dcf0c8203420 Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 18 Jan 1999 06:26:26 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'TAO-0_2_52'. --- examples/IPC_SAP/TLI_SAP/ftp-server.cpp | 77 --------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 examples/IPC_SAP/TLI_SAP/ftp-server.cpp (limited to 'examples/IPC_SAP/TLI_SAP/ftp-server.cpp') diff --git a/examples/IPC_SAP/TLI_SAP/ftp-server.cpp b/examples/IPC_SAP/TLI_SAP/ftp-server.cpp deleted file mode 100644 index 9f887d8bf49..00000000000 --- a/examples/IPC_SAP/TLI_SAP/ftp-server.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// $Id$ - -/* Simple file transfer example */ - -#include "ace/Thread_Manager.h" -#include "ace/TLI_Acceptor.h" - -ACE_RCSID(TLI_SAP, ftp_server, "$Id$") - -#if defined (ACE_HAS_THREADS) && defined (ACE_HAS_TLI) - -ACE_Thread_Manager thr_mgr; - -void * -read_file (void *fd) -{ - ACE_TLI_Stream stream; - char buf[BUFSIZ]; - int flags = 0; - int n; - - // Cast the arg to a long, first, because a pointer is the same - // size as a long on all current ACE platforms. - stream.set_handle ((int) (long) fd); - - ACE_OS::printf ("start (tid = %d, fd = %d)\n", ACE_OS::thr_self (), stream.get_handle ()); - ACE_OS::fflush (stdout); - - while ((n = stream.recv (buf, sizeof buf, &flags)) > 0) - continue; - - ACE_UNUSED_ARG (n); - - ACE_OS::printf ("finish (tid = %d, fd = %d)\n", ACE_OS::thr_self (), stream.get_handle ()); - - if (stream.close () == -1) - ACE_OS::t_error ("stream.close error"); - - return 0; -} - -int -main (int argc, char *argv[]) -{ - u_short port = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT; - ACE_TLI_Acceptor server; - ACE_TLI_Stream new_stream; - - // Open the server and reuse the address if in use... - if (server.open (ACE_INET_Addr (port), 1) == -1) - ACE_OS::t_error ("server.open"), ACE_OS::exit (1); - - /* Wait for a connection from a client. This is an example of a concurrent server */ - - for (int count = 1; ; count++) - { - ACE_OS::fprintf (stderr, "thread %d, blocking for accept #%d\n", - ACE_OS::thr_self (), count); - - if (server.accept (new_stream) == -1) - ACE_OS::t_error ("server.accept error"); - - else if (thr_mgr.spawn (ACE_THR_FUNC (read_file), - (void *) new_stream.get_handle (), - THR_DETACHED | THR_BOUND) == -1) - ACE_OS::perror ("can't create worker thread\n"); - } - - ACE_NOTREACHED (return 0); -} -#else -#include -int main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform must support ACE_TLI\n"), 1); -} -#endif /* ACE_HAS_THREADS */ -- cgit v1.2.1