MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / SendUnreliablePacket

Method SendUnreliablePacket

PanzerChasm/net/net.cpp:179–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177 }
178
179 virtual void SendUnreliablePacket( const void* data, unsigned int data_size ) override
180 {
181 if( disconnected_ ) return;
182
183#ifdef _WIN32
184 const int result=
185 ::sendto( udp_socket_, (const char*) data, data_size, 0, (sockaddr*) &destination_udp_address_, sizeof(destination_udp_address_) );
186
187 if( result == SOCKET_ERROR )
188 Log::Warning( FUNC_NAME, " error: ", ::WSAGetLastError() );
189 else if( result < static_cast<int>(data_size) )
190 Log::Warning( FUNC_NAME, " not all data transmited: ", result, " from ", data_size );
191#else
192 const int result=
193 ::sendto( udp_socket_, (const char*) data, data_size, 0, (sockaddr*) &destination_udp_address_, sizeof(destination_udp_address_) );
194
195 if( result == -1 )
196 Log::Warning( FUNC_NAME, " error: ", errno );
197 else if( result < static_cast<int>(data_size) )
198 Log::Warning( FUNC_NAME, " not all data transmited: ", result, " from ", data_size );
199#endif
200 }
201
202 virtual unsigned int ReadRealiableData( void* out_data, unsigned int buffer_size ) override
203 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected