MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / send

Method send

src/server/lcdapi/api/LCDConnection.cpp:100–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void LCDConnection::send(const string &toSend) {
101 const string s = toSend + "\r\n";
102
103#ifdef DEBUG
104 cerr << "Sending : " << s << endl;
105#endif // DEBUG
106
107 if (!_isConnected) {
108 throw LCDException(LCD_SOCKET_NOT_CONNECTED);
109 }
110
111 const int total = s.size();
112 int offset = 0;
113
114 while (offset != total) {
115 const int sent = ::send(_sock, s.c_str() + offset, total - offset, 0);
116 if ( ((sent == -1) && (errno != EAGAIN)) || (sent == 0) ) {
117 throw LCDException(LCD_SOCKET_SEND_ERROR);
118 } else {
119 offset += sent;
120 }
121 }
122}
123
124string LCDConnection::recv() {
125 if (!_isConnected) {

Callers

nothing calls this directly

Calls 3

LCDExceptionClass · 0.85
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected