Esempio n. 1
0
 long connection::
 write (
     const char* buf, 
     long num
 )
 {
     const long old_num = num;
     long status;
     while (num > 0)
     {
         if ( (status = ::send(connection_socket,buf,num,0)) <=0)
         {
             // if send was interupted by a signal then restart it
             if (errno == EINTR)
             {
                 continue;
             }
             else
             {
                 // check if shutdown or shutdown_outgoing have been called
                 if (sdo_called())
                     return SHUTDOWN;
                 else
                     return OTHER_ERROR;
             }
         }
         num -= status;
         buf += status;
     } 
     return old_num;
 }
Esempio n. 2
0
 long connection::
 write (
     const char* buf, 
     long num
 )
 {
     const long old_num = num;
     long status;
     const long max_send_length = 1024*1024*100;
     while (num > 0)
     {
         // Make sure to cap the max value num can take on so that if it is 
         // really large (it might be big on 64bit platforms) so that the OS
         // can't possibly get upset about it being large.
         const long length = std::min(max_send_length, num);
         if ( (status = send(connection_socket,buf,length,0)) == SOCKET_ERROR)
         {
             if (sdo_called())
                 return SHUTDOWN;
             else
                 return OTHER_ERROR;
         }
         num -= status;
         buf += status;
     } 
     return old_num;
 }
Esempio n. 3
0
 long connection::
 write (
     const char* buf, 
     long num
 )
 {
     const long old_num = num;
     long status;
     while (num > 0)
     {
         if ( (status = send(connection_socket,buf,num,0)) == SOCKET_ERROR)
         {
             if (sdo_called())
                 return SHUTDOWN;
             else
                 return OTHER_ERROR;
         }
         num -= status;
         buf += status;
     } 
     return old_num;
 }
 long connection::
 write (
     const char* buf, 
     long num
 )
 {
     const long old_num = num;
     long status;
     const long max_send_length = 1024*1024*100;
     while (num > 0)
     {
         // Make sure to cap the max value num can take on so that if it is 
         // really large (it might be big on 64bit platforms) so that the OS
         // can't possibly get upset about it being large.
         const long length = std::min(max_send_length, num);
         if ( (status = ::send(connection_socket,buf,length,0)) <=0)
         {
             // if send was interupted by a signal then restart it
             if (errno == EINTR)
             {
                 continue;
             }
             else
             {
                 // check if shutdown or shutdown_outgoing have been called
                 if (sdo_called())
                     return SHUTDOWN;
                 else
                     return OTHER_ERROR;
             }
         }
         num -= status;
         buf += status;
     } 
     return old_num;
 }