63 "unix_dgram::sndto: Buffer is NULL!",
false);
69 if (is_nonblocking && errno == EWOULDBLOCK)
74 "unix_dgram::sndto: Could not send data to peer!");
93 return sndto(buf, length, path.c_str(), sendto_flags);
108 return sndto(static_cast<const void*>(buf.c_str()), buf.size(),
109 path.c_str(), sendto_flags);
125 size_t source_len,
int recvfrom_flags) {
128 "unix_dgram::rcvfrom: Buffer is NULL!",
false);
136 if (is_nonblocking && errno == EWOULDBLOCK)
141 "unix_dgram::rcvfrom: Could not receive data from peer!");
160 int recvfrom_flags) {
163 "unix_dgram::rcvfrom: Buffer is NULL!",
false);
167 using std::unique_ptr;
169 unique_ptr<char[]> source_cstr(
172 size_t source_cstr_len;
174 memset(source_cstr.get(), 0, 108);
180 if (is_nonblocking && errno == EWOULDBLOCK)
185 "unix_dgram::rcvfrom: Could not receive data from peer!");
188 source_cstr_len = strlen(source_cstr.get());
190 source.resize(source_cstr_len);
192 source = source_cstr.get();
211 "unix_dgram::rcvfrom: Buffer is empty!",
false);
215 using std::unique_ptr;
217 unique_ptr<char[]> source_cstr(
220 unique_ptr<char[]> cbuf(
new char[buf.size()]);
222 size_t source_cstr_len;
224 memset(source_cstr.get(), 0, 108);
227 source_cstr.get(), 107, recvfrom_flags);
230 if (is_nonblocking && errno == EWOULDBLOCK)
235 "unix_dgram::rcvfrom: Could not receive data from peer!");
238 source_cstr_len = strlen(source_cstr.get());
240 source.resize(source_cstr_len);
243 buf.assign(cbuf.get(), bytes);
244 source.assign(source_cstr.get(), source_cstr_len);
Contains libsocket elements.
ssize_t sndto(const void *buf, size_t length, const char *path, int sendto_flags=0)
Send data to datagram socket.
This class is instantiated and thrown when an error occurs. If there's an error somewhere in libsocke...
ssize_t recvfrom_unix_dgram_socket(int sfd, void *buf, size_t size, char *from, size_t from_size, int recvfrom_flags)
Receive datagram from another UNIX socket.
int sfd
sfd is the sockets API file descriptor
ssize_t sendto_unix_dgram_socket(int sfd, const void *buf, size_t size, const char *path, int sendto_flags)
Send datagram to socket.
ssize_t rcvfrom(void *buf, size_t length, char *source, size_t source_len, int recvfrom_flags=0)
Receive data and store the sender's address.