MFEM  v4.5.2
Finite element discretization library
isockstream.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, 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_ISOCKSTREAM
13 #define MFEM_ISOCKSTREAM
14 
15 #include "../config/config.hpp"
16 #include <sstream>
17 
18 namespace mfem
19 {
20 
21 /** Data type for input socket stream class. The class is used as server
22  to receive data from a client on specified port number. The user gets
23  data from the stream as from any other input stream.
24  @deprecated This class is DEPRECATED. New code should use class
25  @ref socketserver (see socketstream.hpp). */
27 {
28 private:
29  int portnum, portID, socketID, error;
30  char *Buf;
31 
32  int establish();
33  int read_data(int socketid, char *buf, int size);
34 
35 public:
36 
37  /** The constructor takes as input the port number on which it
38  establishes a server. */
39  explicit isockstream(int port);
40 
41  bool good() { return (!error); }
42 
43  /// Start waiting for data and return it in an input stream.
44  void receive(std::istringstream **in);
45 
46  /** Virtual destructor. If the data hasn't been sent it sends it. */
47  ~isockstream();
48 };
49 
50 }
51 
52 #endif
isockstream(int port)
Definition: isockstream.cpp:40
void receive(std::istringstream **in)
Start waiting for data and return it in an input stream.