MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
osockstream.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_OSOCKSTREAM
13 #define MFEM_OSOCKSTREAM
14 
15 #include "socketstream.hpp"
16 
17 namespace mfem
18 {
19 
20 /** Data type for output socket stream class. The class is used as client
21  to send data to a server on a specified port number. One object of the
22  class can be used for one time send of data to the server. The user
23  writes in the stream, as in any other output stream and when the data
24  is ready to be send function send() has to be executed. Otherwise (if
25  not executed) the destructor will send the data.
26  @deprecated This class is DEPRECATED. New code should use class
27  @ref socketstream (see socketstream.hpp). */
28 class osockstream : public socketstream
29 {
30 public:
31 
32  /** The constructor takes as input the name of the server and the
33  port number through which the communication will take place. */
34  osockstream(int port, const char *hostname);
35 
36  /** Send the current in the stream data to the server specified by
37  name "hostname" (in the constructor) on port number "port".
38  Return -1 if data has already been sent or 0 for success. */
39  int send() { (*this) << std::flush; return 0; }
40 
41  /** Virtual destructor. If the data hasn't been sent it sends it. */
42  virtual ~osockstream() { }
43 };
44 
45 }
46 
47 #endif
virtual ~osockstream()
Definition: osockstream.hpp:42
osockstream(int port, const char *hostname)
Definition: osockstream.cpp:18