libsocket 1.5
Network::LocalSocket Class Reference

This class represent a local connection (client and server) More...

#include <localsocket.hh>

Inheritance diagram for Network::LocalSocket:
Network::Socket

Public Member Functions

 LocalSocket ()
 
 LocalSocket (PROTO_KIND pkind)
 
virtual ~LocalSocket ()
 
void writeto (const std::string &str, const std::string &filename)
 function used to send a msg to a specific named socket
 
std::string read ()
 function used by >> operator (read a string on current socket)
 
std::string read (int timeout)
 read a string with a timeout
 
std::string read (std::string &filename)
 read a string and put the client named socket name in filename
 
std::string read (std::string &filename, int timeout)
 read a string and put the client named socket name in filename with a timeout
 
std::string readn (unsigned int size)
 read a string from socket
 
std::string readn (int timeout, unsigned int size)
 read a string with a timeout
 
std::string readn (std::string &filename, unsigned int size)
 read a string and put the client named socket name in filename
 
std::string readn (std::string &filename, int timeout, unsigned int size)
 read a string and put the client named socket name in filename with a timeout
 
void init (const std::string &filename)
 Here is an example of named server server using libsocket :
 
void close ()
 connect to a local socket (client)
 
- Public Member Functions inherited from Network::Socket
 Socket (SOCKET_KIND kind, SOCKET_VERSION version=V4)
 
 Socket (SOCKET_KIND kind, PROTO_KIND pkind, SOCKET_VERSION version=V4)
 
virtual ~Socket ()
 
void write (const std::string &str)
 function used by << operator (write a string on current socket)
 
bool connected () const
 return true when socket is connected
 
int get_socket ()
 get socket (fd) warning: be very carefull with this method
 
void add_delim (const std::string &delim)
 set the delimitor for the text mode
 
void del_delim (const std::string &delim)
 delete this delimitor for the socket
 
void allow_empty_lines ()
 , if set, empty lines will be returned in text procols (if not, they are skipped)
 
void init_tls (GnuTLSKind kind, unsigned size=1024, const std::string &certfile="", const std::string &keyfile="", const std::string &trustfile="", const std::string &crlfile="")
 
void enable_tls ()
 Enable TLS on socket.
 

Protected Member Functions

int _bind (const std::string &filename)
 Initialize a local socket connection (server in UDP) create a named socket with name filename.
 
std::string _read_line (int socket)
 Get a line from socket (when used with textual protocol)
 
std::string _read_line (int socket, std::string &filename)
 Get a line from socket and give client socket filename (for named socket) (when used with textual protocol)
 
std::string _read_line_bin (int socket, unsigned int size)
 Get a line from socket (when used with binary protocol)
 
std::string _read_line_bin (int socket, std::string &filename, unsigned int pkg_size)
 Get a line from socket and give client socket filename (for named socket) (when used with binary protocol)
 
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)
 
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)
 
- Protected Member Functions inherited from Network::Socket
void _close (int socket) const
 Close a connnection.
 
void _listen (int socket) const
 Listen on port.
 
void _write_str (int socket, const std::string &str) const
 Write a string to a socket (when used with textual protocol)
 
void _write_str_bin (int socket, const std::string &str) const
 Write a string to a socket (when used with binary protocol)
 
void _set_timeout (bool enable, int socket, int timeout)
 set a timeout on a socket
 
std::pair< int, int > _find_delim (const std::string &str, int start) const
 
bool _update_buffer (std::pair< int, int > &delim, int &i, std::string &str)
 look delimiter and remove delimiter at begining of buffer if needed
 
bool _check_answer (int res, std::string &str)
 return the content of the buffer is there is
 

Protected Attributes

std::string _filename
 
- Protected Attributes inherited from Network::Socket
SOCKET_KIND _kind
 
SOCKET_VERSION _version
 
unsigned _state_timeout
 
int _socket
 
int _recv_flags
 
struct sockaddr_in _addr
 
PROTO_KIND _proto_kind
 
std::list< std::string > _delim
 
bool _empty_lines
 
std::string _buffer
 
bool _tls
 

Detailed Description

This class represent a local connection (client and server)

Author
Julien Lemoine <speedblue at happycoders dot org>

Definition at line 34 of file localsocket.hh.

Constructor & Destructor Documentation

◆ LocalSocket() [1/2]

Network::LocalSocket::LocalSocket ( )
inline

Definition at line 37 of file localsocket.hh.

37 :
39 {}
Socket(SOCKET_KIND kind, SOCKET_VERSION version=V4)
Definition socket.cc:31
@ LOCAL
Definition socket.hh:82

◆ LocalSocket() [2/2]

Network::LocalSocket::LocalSocket ( PROTO_KIND  pkind)
inline

Definition at line 40 of file localsocket.hh.

40 :
41 Socket(LOCAL, pkind), _filename("")
42 {}

◆ ~LocalSocket()

virtual Network::LocalSocket::~LocalSocket ( )
inlinevirtual

Definition at line 44 of file localsocket.hh.

45 {
46 close();
47 }
void close()
connect to a local socket (client)

References close().

Member Function Documentation

◆ _bind()

int Network::LocalSocket::_bind ( const std::string &  filename)
protected

Initialize a local socket connection (server in UDP) create a named socket with name filename.

Exceptions
NoConnectionwhen there is no open socket
BindErrorwhen bind libc function return a negative value

Definition at line 49 of file localsocket.cc.

50 {
51 int s;
52 struct sockaddr_un name;
53 size_t size;
54
55 s = socket(PF_UNIX, SOCK_DGRAM, 0);
56 if (s < 0)
57 throw NoConnection("Socket error", HERE);
58 name.sun_family = AF_UNIX;
59 strncpy(name.sun_path, filename.c_str(), sizeof (name.sun_path));
60 name.sun_path[sizeof (name.sun_path) - 1] = '\0';
61 size = (offsetof (struct sockaddr_un, sun_path)
62 + strlen (name.sun_path) + 1);
63 if (bind (s, (struct sockaddr *) &name, size) < 0)
64 throw BindError("Bind error", HERE);
65 return s;
66 }
#define HERE

References HERE.

Referenced by init().

◆ _read_line() [1/2]

std::string Network::LocalSocket::_read_line ( int  socket)
protectedvirtual

Get a line from socket (when used with textual protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Implements Network::Socket.

Definition at line 212 of file localsocket.cc.

213 {
214 char chr[MAXPKTSIZE];
215 std::string str = "";
216 int res = 1, i;
217 std::pair<int, int> delim;
218 bool end = false;
219
220 if (socket < 0)
221 throw NoConnection("No Socket", HERE);
222 if (!_update_buffer(delim, i, str))
223 while (!end)
224 {
225 memset(chr, 0, MAXPKTSIZE);
226#ifdef __CYGWIN__
227 res = recv(socket, chr, MAXPKTSIZE, 0);
228#else
229 res = recv(socket, chr, MAXPKTSIZE, MSG_TRUNC);
230#endif
231 if (res <= 0)
232 throw ConnectionClosed("Connection Closed", HERE);
233 _buffer += std::string(chr, res);
234 if (_update_buffer(delim, i, str))
235 end = true;
236 }
237 _state_timeout = 0;
238 return str;
239 }
std::string _buffer
Definition socket.hh:202
unsigned _state_timeout
Definition socket.hh:192
bool _update_buffer(std::pair< int, int > &delim, int &i, std::string &str)
look delimiter and remove delimiter at begining of buffer if needed
Definition socket.hxx:45

References Network::Socket::_buffer, Network::Socket::_state_timeout, Network::Socket::_update_buffer(), and HERE.

Referenced by read(), read(), read(), and read().

◆ _read_line() [2/2]

std::string Network::LocalSocket::_read_line ( int  socket,
std::string &  filename 
)
protected

Get a line from socket and give client socket filename (for named socket) (when used with textual protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Definition at line 120 of file localsocket.cc.

122 {
123 char chr[MAXPKTSIZE];
124 std::string str = "";
125 int res = 1, i;
126 std::pair<int, int> delim;
127 struct sockaddr_un addr;
128 size_t size;
129 bool end = false;
130
131 size = sizeof(addr);
132 if (socket < 0)
133 throw NoConnection("No Socket", HERE);
134 if (!_update_buffer(delim, i, str))
135 while (!end)
136 {
137#ifdef __CYGWIN__
138 res = recvfrom(socket, chr, MAXPKTSIZE, 0,
139 (struct sockaddr*)&addr,
140 (socklen_t*)&size);
141#else
142 res = recvfrom(socket, chr, MAXPKTSIZE, MSG_TRUNC,
143 (struct sockaddr*)&addr,
144 (socklen_t*)&size);
145#endif
146 if (res <= 0)
147 throw ConnectionClosed("Connection Closed", HERE);
148 _buffer += std::string(chr, res);
149 if (_update_buffer(delim, i, str))
150 end = true;
151 }
152 filename = std::string(addr.sun_path);
153 _state_timeout = 0;
154 return str;
155 }

References Network::Socket::_buffer, Network::Socket::_state_timeout, Network::Socket::_update_buffer(), and HERE.

◆ _read_line_bin() [1/2]

std::string Network::LocalSocket::_read_line_bin ( int  socket,
std::string &  filename,
unsigned int  pkg_size 
)
protected

Get a line from socket and give client socket filename (for named socket) (when used with binary protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Definition at line 241 of file localsocket.cc.

244 {
245 char chr[MAXPKTSIZE];
246 std::string str = "";
247 int res = 1;
248 struct sockaddr_un addr;
249 size_t size;
250 bool end = false;
251
252 size = sizeof(addr);
253 if (socket < 0)
254 throw NoConnection("No Socket", HERE);
255 if (_buffer.size() >= 2 && !pkg_size)
256 {
257 pkg_size = (unsigned char)_buffer[0] * 256 + (unsigned char)_buffer[1];
258 _buffer = _buffer.substr(2, _buffer.size() - 2);
259 }
260 if (pkg_size && _buffer.size() >= pkg_size)
261 {
262 str = _buffer.substr(0, pkg_size);
263 _buffer = _buffer.substr(pkg_size, _buffer.size() - pkg_size);
264 }
265 else
266 while (!end)
267 {
268#ifdef __CYGWIN__
269 res = recvfrom(socket, chr, MAXPKTSIZE, 0,
270 (struct sockaddr*)&addr,
271 (socklen_t*)&size);
272#else
273 res = recvfrom(socket, chr, MAXPKTSIZE, MSG_TRUNC,
274 (struct sockaddr*)&addr,
275 (socklen_t*)&size);
276#endif
277 if (res <= 0)
278 throw ConnectionClosed("Connection Closed", HERE);
279 // _buffer += all octets received
280 _buffer += std::string(chr, res).substr(0, res);
281 if (!pkg_size)
282 {
283 // extract size from _buffer and reduce it
284 pkg_size = (unsigned char)_buffer[0] * 256 +
285 (unsigned char)_buffer[1];
286 _buffer = _buffer.substr(2, _buffer.size() - 2);
287 }
288 if (_buffer.size() > pkg_size - str.size())
289 {
290 str += _buffer.substr(0, pkg_size - str.size());
291 _buffer = _buffer.substr(pkg_size - str.size(),
292 _buffer.size() - pkg_size - str.size());
293 }
294 else
295 {
296 str += _buffer;
297 _buffer = "";
298 }
299 if (str.size() >= pkg_size)
300 end = true;
301 }
302 filename = std::string(addr.sun_path);
303 return str;
304 }

References Network::Socket::_buffer, and HERE.

◆ _read_line_bin() [2/2]

std::string Network::LocalSocket::_read_line_bin ( int  socket,
unsigned int  size 
)
protectedvirtual

Get a line from socket (when used with binary protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Implements Network::Socket.

Definition at line 157 of file localsocket.cc.

158 {
159 char chr[MAXPKTSIZE];
160 std::string str = "";
161 int res = 1;
162 bool end = false;
163
164 if (socket < 0)
165 throw NoConnection("No Socket", HERE);
166 if (_buffer.size() >= 2 && !size)
167 {
168 size = (unsigned char)_buffer[0] * 256 + (unsigned char)_buffer[1];
169 _buffer = _buffer.substr(2, _buffer.size() - 2);
170 }
171 if (size && _buffer.size() >= size)
172 {
173 str = _buffer.substr(0, size);
174 _buffer = _buffer.substr(size, _buffer.size() - size);
175 }
176 else
177 while (!end)
178 {
179 memset(chr, 0, MAXPKTSIZE);
180#ifdef __CYGWIN__
181 res = recv(socket, chr, MAXPKTSIZE, 0);
182#else
183 res = recv(socket, chr, MAXPKTSIZE, MSG_TRUNC);
184#endif
185 if (res <= 0)
186 throw ConnectionClosed("Connection Closed", HERE);
187 // _buffer += all octets received
188 _buffer += std::string(chr, res);
189 if (!size)
190 {
191 // extract size from _buffer and reduce it
192 size = (unsigned char)_buffer[0] * 256 + (unsigned char)_buffer[1];
193 _buffer = _buffer.substr(2, _buffer.size() - 2);
194 }
195 if (_buffer.size() > size - str.size())
196 {
197 str += _buffer.substr(0, size - str.size());
198 _buffer = _buffer.substr(size - str.size(),
199 _buffer.size() - size - str.size());
200 }
201 else
202 {
203 str += _buffer;
204 _buffer = "";
205 }
206 if (str.size() >= size)
207 end = true;
208 }
209 return str;
210 }

References Network::Socket::_buffer, and HERE.

Referenced by read(), read(), read(), read(), readn(), readn(), readn(), and readn().

◆ _write_str()

void Network::LocalSocket::_write_str ( int  socket,
const std::string &  str,
const std::string &  filename 
) const
protected

Write a string to a socket to a particular named socket (when used with textual protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Definition at line 68 of file localsocket.cc.

70 {
71 int res = 1;
72 const char *buf = str.c_str();
73 unsigned int count = 0;
74 struct sockaddr_un name;
75
76 name.sun_family = AF_UNIX;
77 strncpy(name.sun_path, filename.c_str(), sizeof (name.sun_path));
78 name.sun_path[sizeof (name.sun_path) - 1] = '\0';
79
80 if (socket < 0)
81 throw NoConnection("No Socket", HERE);
82 while (res && count < str.size())
83 {
84 res = sendto(socket, buf + count,
85 str.size() - count, SENDTO_FLAGS,
86 (const struct sockaddr*)&name, sizeof(name));
87 if (res <= 0)
88 throw ConnectionClosed("Connection Closed", HERE);
89 count += res;
90 }
91 }
#define SENDTO_FLAGS
Definition socket.hh:48

References HERE, and SENDTO_FLAGS.

Referenced by writeto().

◆ _write_str_bin()

void Network::LocalSocket::_write_str_bin ( int  socket,
const std::string &  str,
const std::string &  filename 
) const
protected

Write a string to a socket to a particular named socket (when used with binary protocol)

Exceptions
NoConnectionwhen there is no open socket
ConnectionClosedwhen there is no more connection

Definition at line 93 of file localsocket.cc.

95 {
96 int res = 1;
97 unsigned int count = 0;
98 struct sockaddr_un name;
99 char buf[str.size() + 2];
100
101 buf[0] = str.size() / 256;
102 buf[1] = str.size() % 256;
103 memcpy(buf + 2, str.c_str(), str.size());
104 name.sun_family = AF_UNIX;
105 strncpy(name.sun_path, filename.c_str(), sizeof (name.sun_path));
106 name.sun_path[sizeof (name.sun_path) - 1] = DEFAULT_DELIM;
107
108 if (socket < 0)
109 throw NoConnection("No Socket", HERE);
110 while (res && count < str.size() + 2)
111 {
112 res = sendto(socket, buf + count, str.size() + 2 - count, SENDTO_FLAGS,
113 (const struct sockaddr*)&name, sizeof(name));
114 if (res <= 0)
115 throw ConnectionClosed("Connection Closed", HERE);
116 count += res;
117 }
118 }

References HERE, and SENDTO_FLAGS.

Referenced by writeto().

◆ close()

void Network::LocalSocket::close ( )

connect to a local socket (client)

Definition at line 40 of file localsocket.cc.

41 {
42 if (_socket > 0)
44 _socket = 0;
45 unlink(_filename.c_str());
46 _filename = "";
47 }
void _close(int socket) const
Close a connnection.
Definition socket.cc:167

References Network::Socket::_close(), _filename, and Network::Socket::_socket.

Referenced by ~LocalSocket().

◆ init()

void Network::LocalSocket::init ( const std::string &  filename)

Here is an example of named server server using libsocket :

  #include <stdlib.h>
  #include <iostream>
  #include <string>
  #include "socket/localsocket.hh"

  int main(int argc, char **argv)
  {
    Network::LocalSocket                server;
    std::string                 filename, client, str("");

    if (argc < 2)
      {
        std::cout << "Use: " << argv[0] << " filename" << std::endl;
        exit(0);
      }
    try
      {
        filename = std::string(argv[1]);
        server.init(filename);
        while (str != "quit")
        {
          //server.read(filename 30); //read with a timeout of 30 seconds
          //server >> str; //read without geting the named name
          //(cannot sent data)
          str = server.read(client);
          std::string msg = "ok, I received [" + str + "]";
          server.writeto(msg, client);
          std::cout << "[" << str << "] from : " << client << std::endl;
        }
        server.close();
        exit (0);
      }
    catch (Network::Timeout e)
      {
        std::cerr << e;
        std::cerr << "No connection during last 30s, closing connection" 
                << std::endl;
        exit (1);
      }
    catch (Network::Exception e)
      {
        std::cerr << e;
        exit(1);
      }
  }

  

Here is an example of named server server using libsocket :

#include <stdlib.h>
  #include <iostream>
  #include <string>
  #include "socket/localsocket.hh"

  int main(int argc, char **argv)
  {
    Network::LocalSocket                client;
    std::string                 client_filename, server_filename, str(""), msg;

    if (argc < 3)
      {
        std::cout << "Use: " << argv[0] << " <client_filename> " 
                << "<server_filename>" << std::endl;
        exit(0);
      }
    try
      {
        client_filename = std::string(argv[1]);
        server_filename = std::string(argv[2]);

        client.init(client_filename);
        while (str != "quit")
        {
          std::cout << "Msg: ";
          std::cin >> str;
          client.writeto(str, server_filename);
          client >> msg;
          std::cout << "[received] " << msg << std::endl;
        }
        client.close();
        exit (0);
      }
    catch (Network::Timeout e)
      {
        std::cerr << e;
        std::cerr << "No connection during last 30s, closing connection" 
                << std::endl;
        exit (1);
      }
    catch (Network::Exception e)
      {
        std::cerr << e;
        exit(1);
      }
  }

  

Initialize a local socket (server)

Definition at line 34 of file localsocket.cc.

35 {
36 _socket = _bind(filename);
37 _filename = filename;
38 }
int _bind(const std::string &filename)
Initialize a local socket connection (server in UDP) create a named socket with name filename.

References _bind(), _filename, and Network::Socket::_socket.

◆ read() [1/4]

std::string Network::LocalSocket::read ( )
virtual

function used by >> operator (read a string on current socket)

Implements Network::Socket.

Definition at line 352 of file localsocket.cc.

353 {
354 if (_proto_kind == binary)
355 return _read_line_bin(_socket, 0);
356 else
357 return _read_line(_socket);
358 }
std::string _read_line(int socket)
Get a line from socket (when used with textual protocol)
std::string _read_line_bin(int socket, unsigned int size)
Get a line from socket (when used with binary protocol)
PROTO_KIND _proto_kind
Definition socket.hh:199
@ binary
Definition socket.hh:75

References Network::Socket::_proto_kind, _read_line(), _read_line_bin(), Network::Socket::_socket, and Network::binary.

◆ read() [2/4]

std::string Network::LocalSocket::read ( int  timeout)
virtual

read a string with a timeout

Implements Network::Socket.

Definition at line 360 of file localsocket.cc.

361 {
362 if (_proto_kind == binary)
363 {
364 _set_timeout(true, _socket, timeout);
365 return _read_line_bin(_socket, 0);
366 }
367 else
368 {
369 _state_timeout = timeout;
370 return _read_line(_socket);
371 }
372 }
void _set_timeout(bool enable, int socket, int timeout)
set a timeout on a socket
Definition socket.cc:272

References Network::Socket::_proto_kind, _read_line(), _read_line_bin(), Network::Socket::_set_timeout(), Network::Socket::_socket, Network::Socket::_state_timeout, and Network::binary.

◆ read() [3/4]

std::string Network::LocalSocket::read ( std::string &  filename)

read a string and put the client named socket name in filename

Definition at line 374 of file localsocket.cc.

375 {
376 if (_proto_kind)
377 return _read_line_bin(_socket, filename, 0);
378 else
379 return _read_line(_socket, filename);
380 }

References Network::Socket::_proto_kind, _read_line(), _read_line_bin(), and Network::Socket::_socket.

◆ read() [4/4]

std::string Network::LocalSocket::read ( std::string &  filename,
int  timeout 
)

read a string and put the client named socket name in filename with a timeout

Definition at line 382 of file localsocket.cc.

383 {
384 if (_proto_kind == binary)
385 {
386 _set_timeout(true, _socket, timeout);
387 return _read_line_bin(_socket, filename, 0);
388 }
389 else
390 {
391 _state_timeout = timeout;
392 return _read_line(_socket, filename);
393 }
394 }

References Network::Socket::_proto_kind, _read_line(), _read_line_bin(), Network::Socket::_set_timeout(), Network::Socket::_socket, Network::Socket::_state_timeout, and Network::binary.

◆ readn() [1/4]

std::string Network::LocalSocket::readn ( int  timeout,
unsigned int  size 
)
virtual

read a string with a timeout

Parameters
sizerepresente the number of byte to read

Implements Network::Socket.

Definition at line 323 of file localsocket.cc.

324 {
325 if (!size || size > _buffer.size())
326 _set_timeout(true, _socket, timeout);
327 // _read_line_bin is bufferised with the same buffer as textual
328 // protocols, so this function can be used for binary and text
329 // protocols.
330 return _read_line_bin(_socket, size);
331 }

References Network::Socket::_buffer, _read_line_bin(), Network::Socket::_set_timeout(), and Network::Socket::_socket.

◆ readn() [2/4]

std::string Network::LocalSocket::readn ( std::string &  filename,
int  timeout,
unsigned int  size 
)

read a string and put the client named socket name in filename with a timeout

Parameters
sizerepresente the number of byte to read

Definition at line 341 of file localsocket.cc.

343 {
344 if (!size || size > _buffer.size())
345 _set_timeout(true, _socket, timeout);
346 // _read_line_bin is bufferised with the same buffer as textual
347 // protocols, so this function can be used for binary and text
348 // protocols.
349 return _read_line_bin(_socket, filename, size);
350 }

References Network::Socket::_buffer, _read_line_bin(), Network::Socket::_set_timeout(), and Network::Socket::_socket.

◆ readn() [3/4]

std::string Network::LocalSocket::readn ( std::string &  filename,
unsigned int  size 
)

read a string and put the client named socket name in filename

Parameters
sizerepresente the number of byte to read

Definition at line 333 of file localsocket.cc.

334 {
335 // _read_line_bin is bufferised with the same buffer as textual
336 // protocols, so this function can be used for binary and text
337 // protocols.
338 return _read_line_bin(_socket, filename, size);
339 }

References _read_line_bin(), and Network::Socket::_socket.

◆ readn() [4/4]

std::string Network::LocalSocket::readn ( unsigned int  size)
virtual

read a string from socket

Parameters
sizerepresente the number of byte to read

Implements Network::Socket.

Definition at line 315 of file localsocket.cc.

316 {
317 // _read_line_bin is bufferised with the same buffer as textual
318 // protocols, so this function can be used for binary and text
319 // protocols.
320 return _read_line_bin(_socket, size);
321 }

References _read_line_bin(), and Network::Socket::_socket.

◆ writeto()

void Network::LocalSocket::writeto ( const std::string &  str,
const std::string &  filename 
)

function used to send a msg to a specific named socket

Definition at line 306 of file localsocket.cc.

308 {
309 if (_proto_kind == binary)
310 _write_str_bin(_socket, str, filename);
311 else
312 _write_str(_socket, str, filename);
313 }
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)
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)

References Network::Socket::_proto_kind, Network::Socket::_socket, _write_str(), _write_str_bin(), and Network::binary.

Member Data Documentation

◆ _filename

std::string Network::LocalSocket::_filename
protected

Definition at line 224 of file localsocket.hh.

Referenced by close(), and init().


The documentation for this class was generated from the following files: