27 #ifndef LOCAL_SOCKET_HH_ 28 # define LOCAL_SOCKET_HH_ 51 void writeto(
const std::string& str,
52 const std::string& filename);
58 std::string
read(
int timeout);
60 std::string
read(std::string& filename);
63 std::string
read(std::string& filename,
int timeout);
66 std::string
readn(
unsigned int size);
69 std::string
readn(
int timeout,
unsigned int size);
72 std::string
readn(std::string& filename,
unsigned int size);
76 std::string
readn(std::string& filename,
int timeout,
unsigned int size);
179 void init(
const std::string& filename);
190 int _bind(
const std::string& filename);
199 std::string
_read_line(
int socket, std::string& filename);
209 unsigned int pkg_size);
214 void _write_str(
int socket,
const std::string& str,
215 const std::string& filename)
const;
221 const std::string& filename)
const;
This class represent an abstract socket connection (udp | tcp server | tcp client) ...
LocalSocket(PROTO_KIND pkind)
Network namespace represent all networks connection.
void init(const std::string &filename)
Here is an example of named server server using libsocket :
void writeto(const std::string &str, const std::string &filename)
function used to send a msg to a specific named socket
std::string _read_line_bin(int socket, unsigned int size)
Get a line from socket (when used with binary protocol) when there is no open socket when there is no...
std::string _read_line(int socket)
Get a line from socket (when used with textual protocol) when there is no open socket when there is n...
This class represent a local connection (client and server)
std::string read()
function used by >> operator (read a string on current socket)
enum Network::e_pkind PROTO_KIND
int _bind(const std::string &filename)
Initialize a local socket connection (server in UDP) create a named socket with name filename when th...
void _write_str(int socket, const std::string &str, const std::string &filename) const
Write a string to a socket to a particular named socket (when used with textual protocol) when there ...
void _write_str_bin(int socket, const std::string &str, const std::string &filename) const
Write a string to a socket to a particular named socket (when used with binary protocol) when there i...
std::string readn(unsigned int size)
read a string from socket
void close()
connect to a local socket (client)