14 #ifndef ECL_DEVICES_SOCKET_SERVER_POS_HPP_
15 #define ECL_DEVICES_SOCKET_SERVER_POS_HPP_
21 #include <ecl/config/ecl.hpp>
29 #include <arpa/inet.h>
30 #include <sys/ioctl.h>
32 #include <sys/socket.h>
65 SocketServer() : is_open(false) {};
76 SocketServer(
const unsigned int &port_number);
77 virtual ~SocketServer() { close(); };
92 bool open(
const unsigned int& port_number );
110 void close() { is_open =
false; ::close(socket_fd); }
112 bool open()
const {
return is_open; }
125 long write(
const char &c) {
return write(&c,1); }
135 long write(
const char *s,
unsigned long n);
174 long read(
char &c) {
return read(&c,1); }
184 long read(
char *s,
const unsigned long &n);
195 long peek(
char*s,
const unsigned long &n);
213 const Error& error()
const {
return error_handler; }
218 int client_socket_fd;
232 class is_sink<SocketServer> :
public True {};
240 class is_source<SocketServer> :
public True {};
248 class is_sourcesink<SocketServer> :
public True {};