12 #ifndef MFEM_SOCKETSTREAM
13 #define MFEM_SOCKETSTREAM
15 #include "../config/config.hpp"
24 int socket_descriptor;
25 static const int buflen = 1024;
26 char ibuf[buflen], obuf[buflen];
31 socket_descriptor = -1;
36 socket_descriptor = sd;
37 setp(obuf, obuf + buflen);
42 socket_descriptor = -1;
52 int open(
const char hostname[],
int port);
58 bool is_open() {
return (socket_descriptor >= 0); }
67 virtual int_type
overflow(int_type c = traits_type::eof());
69 virtual std::streamsize
xsgetn(char_type *__s, std::streamsize __n);
71 virtual std::streamsize
xsputn(
const char_type *__s, std::streamsize __n);
86 : std::iostream(&__buf) {
open(hostname, port); }
90 int open(
const char hostname[],
int port)
92 int err = __buf.
open(hostname, port);
94 setstate(std::ios::failbit);
114 bool good() {
return (listen_socket >= 0); }
virtual std::streamsize xsgetn(char_type *__s, std::streamsize __n)
int getsocketdescriptor()
int accept(socketstream &sockstr)
virtual int_type underflow()
socketstream(const char hostname[], int port)
virtual int_type overflow(int_type c=traits_type::eof())
virtual std::streamsize xsputn(const char_type *__s, std::streamsize __n)
int open(const char hostname[], int port)
socketbuf(const char hostname[], int port)
int open(const char hostname[], int port)