deps/PicklingTools170Release/M2k/udpif/udpservice.cc
int_4 UDPService::writeTo (const void*         buf, 
                           const int_4         bytes,
                           const string        destHost,
                           const int_4         destPort)
{ 
  int_u4               flags (0);   
  int_4                NumBytes = -1;

    try {
      //
      // sendTo()   returns;  n > 0:  # bytes read
      //                      n = 0:  no data written; EWOULDBLOCK or EAGAIN
      //                              from NONBLOCK socket setting, maybe..
      //                      n < 0:  "something wicked this way comes..."
      //                              sets errno
      //
      NumBytes = UDPSocketLib::UDP_sendTo (private_->socket_fd,
                                           (unsigned char *)buf, 
                                           bytes, 
                                           flags, 
                                           destHost, 
                                           destPort);

    } catch (const SocketLowLevelEx& e) {
        log_.error ("UDPService::[writeTo]- Failed UDP write to <" + 
                    destHost + ":" + Stringize(destPort) + ">");
        log_.error ("UDPService::[writeTo]- " + e.problem());
      }

    return NumBytes;

}
//
// Preconditions: 
//
// Postconditions:
//
// Parameters:
//   const void*         buf        IN;  buffer of data to send
//   const int_4         bytes      IN;  number bytes in buf to send
//   const string        destHost   IN;  destination hostname
//   const int_4         destPort   IN;  destination port number
//
// Description:
//   Send data in buf over network using UDP from Host:Port to
//   destination defined parameters, destHost:destPort
//
//


const void*         buf        IN;  buffer of data to send
const int_4         bytes      IN;  number bytes in buf to send
const string        destHost   IN;  destination hostname
const int_4         destPort   IN;  destination port number

Send data in buf over network using UDP from Host:Port to
destination defined parameters, destHost:destPort
const void * buf IN ; buffer of data to send const int_4 bytes IN ; number bytes in buf to send const string destHost IN ; destination hostname const int_4 destPort IN ; destination port number Send data in buf over network using UDP from Host : Port to destination defined parameters destHost : destPort
int_4 UDPService::writeTo (const void*         buf, 
                           const int_4         bytes,
                           const string        destHost,
                           const int_4         destPort)
{ 
  int_u4               flags (0);   
  int_4                NumBytes = -1;
    try {
       sendTo()   returns;  n > 0:  # bytes read
                            n = 0:  no data written; EWOULDBLOCK or EAGAIN
                                    from NONBLOCK socket setting, maybe..
                            n < 0:  "something wicked this way comes..."
                                    sets errno
      NumBytes = UDPSocketLib::UDP_sendTo (private_->socket_fd,
                                           (unsigned char *)buf, 
                                           bytes, 
                                           flags, 
                                           destHost, 
                                           destPort);
    } catch (const SocketLowLevelEx& e) {
        log_.error ("UDPService::[writeTo]- Failed UDP write to <" + 
                    destHost + ":" + Stringize(destPort) + ">");
        log_.error ("UDPService::[writeTo]- " + e.problem());
      }
    return NumBytes;
}
int_4 UDPService :: writeTo ( const void * buf , const int_4 bytes , const string destHost , const int_4 destPort ) { int_u4 flags ( 0 ) ; int_4 NumBytes = -1 ; try { NumBytes = UDPSocketLib :: UDP_sendTo ( private_ -> socket_fd , ( unsigned char * ) buf , bytes , flags , destHost , destPort ) ; } catch ( const SocketLowLevelEx & e ) { log_ . error ( " " + destHost + " " + Stringize ( destPort ) + " " ) ; log_ . error ( " " + e . problem ( ) ) ; } return NumBytes ; }
Preconditions:
Postconditions:
Preconditions : Postconditions :
// // sendTo()   returns;  n > 0:  # bytes read //                      n = 0:  no data written; EWOULDBLOCK or EAGAIN //                              from NONBLOCK socket setting, maybe.. //                      n < 0:  "something wicked this way comes..." //                              sets errno //