MCPcopy Create free account
hub / github.com/dermesser/libsocket / snd

Method snd

C++/dgramclient.cpp:135–148  ·  view source on GitHub ↗

* @brief Send data to connected socket * * @param buf Pointer to the data * @param len The length of the buffer * @param flags Flags for `send(2)` * * @retval n *n* bytes were sent * @retval <0 An error occurred. */

Source from the content-addressed store, hash-verified

133 * @retval <0 An error occurred.
134 */
135ssize_t dgram_client_socket::snd(const void* buf, size_t len, int flags) {
136 ssize_t bytes;
137
138 if (connected != true)
139 throw socket_exception(
140 __FILE__, __LINE__,
141 "dgram_client_socket::snd() - Socket is not connected!", false);
142
143 if (-1 == (bytes = send(sfd, buf, len, flags)))
144 throw socket_exception(__FILE__, __LINE__,
145 "dgram_client_socket::snd() - send() failed!");
146
147 return bytes;
148}
149
150/**
151 * @brief Send data to connected peer

Callers 3

sndmsgMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 1

socket_exceptionClass · 0.85

Tested by

no test coverage detected