MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / WriteTo

Method WriteTo

sourcecommon/udp.cpp:384–414  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

382}
383//---------------------------------------------------------------------------
384bool TUDP::WriteTo(void * data, int size, struct sockaddr * p)
385{
386 WSAError = 0;
387 Error = 0;
388
389 if( !handle )
390 {
391 WSAError = MYERROR_UNKNOWNPARAMS;
392 Error = 1;
393 if( Exceptions ) throw 0;
394 return !Error;
395 }
396
397 int rv = sendto(handle, (char *)data, size, 0, p, sizeof(struct sockaddr));
398 if( rv == SOCKET_ERROR )
399 {
400 WSAError = WSAGetLastError();
401 Error = 2;
402 if( Exceptions ) throw 0;
403 return !Error;
404 }
405 if( rv != size )
406 {
407 WSAError = WSAGetLastError();
408 Error = 3;
409 if( Exceptions ) throw 0;
410 return !Error;
411 }
412 OutBytes += size;
413 return ! Error;
414}
415//---------------------------------------------------------------------------
416bool TUDP::ReadFrom(void * data, int size, struct sockaddr * p, bool bPeek)
417{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected