Ejemplo n.º 1
0
void send_packet (base_socket& socket,
                  const void* buffer, size_t bufsize) {
   const char* bufptr = (const char*) buffer;
   size_t ntosend = bufsize;
   do {
      size_t nbytes = socket.send (bufptr, ntosend);
      bufptr += nbytes;
      ntosend -= nbytes;
   }while (ntosend > 0);
}
Ejemplo n.º 2
0
void send_packet (base_socket& socket,
                  const void* buffer, size_t bufsize) {
   const char* bufptr = static_cast<const char*> (buffer);
   ssize_t ntosend = bufsize;
   do {
      ssize_t nbytes = socket.send (bufptr, ntosend);
      if (nbytes < 0) throw socket_sys_error (to_string (socket));
      bufptr += nbytes;
      ntosend -= nbytes;
   }while (ntosend > 0);
}