MFEM  v3.3
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
isockstream.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
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  This class is DEPRECATED. New code should use class socketserver (see
25  "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:37
void receive(std::istringstream **in)
Start waiting for data and return it in an input stream.