MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / SocketTCPSend

Method SocketTCPSend

Source/Network/asnetwork.cpp:149–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149int ASNetwork::SocketTCPSend(SocketID socket, const uint8_t* buf, size_t len) {
150 std::map<SocketID, SocketData>::iterator datait = sockets.find(socket);
151 if (datait != sockets.end()) {
152 SocketData& sd = datait->second;
153 int ret_data_size = SDLNet_TCP_Send(sd.socket, buf, len);
154 if (ret_data_size < (int)len) {
155 sd.valid = false;
156 DestroySocketTCP(socket);
157 LOGE << "Error when trying to send data on socket, error: \"" << SDLNet_GetError() << "\", shutting it down." << std::endl;
158 }
159 return ret_data_size;
160 } else {
161 LOGE << "unable to send data, no such socket " << socket << std::endl;
162 return -1;
163 }
164}
165
166bool ASNetwork::IsValidSocketTCP(SocketID socket) {
167 std::map<SocketID, SocketData>::iterator datait = sockets.find(socket);

Callers 1

AS_SocketTCPSendFunction · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected