TAO_GIOP_Utils Class Reference

Utility class that has some commonly used methods for both GIOP Base & GIOP lite. More...

#include <GIOP_Utils.h>

List of all members.

Static Public Member Functions

int read_bytes_input (TAO_Transport *transport, TAO_InputCDR &cdr, CORBA::ULong buf_size, ACE_Time_Value *value=0)
ssize_t read_buffer (TAO_Transport *transport, char *buf, size_t len, ACE_Time_Value *max_wait_time=0)


Detailed Description

Utility class that has some commonly used methods for both GIOP Base & GIOP lite.

Definition at line 138 of file GIOP_Utils.h.


Member Function Documentation

ssize_t TAO_GIOP_Utils::read_buffer TAO_Transport transport,
char *  buf,
size_t  len,
ACE_Time_Value max_wait_time = 0
[static]
 

Definition at line 49 of file GIOP_Utils.cpp.

References ACE_DEBUG, ACE_TEXT, ECONNRESET, TAO_Transport::id(), LM_DEBUG, TAO_Transport::recv(), and ssize_t.

00053 {
00054   ssize_t bytes_read = transport->recv (buf, len, max_wait_time);
00055 
00056   if (bytes_read <= 0 && TAO_debug_level > 0)
00057     ACE_DEBUG ((LM_DEBUG,
00058                 ACE_TEXT ("TAO (%P|%t|%N|%l) - %p,\n")
00059                 ACE_TEXT ("              transport = %d, ")
00060                 ACE_TEXT ("bytes = %d, len = %d\n"),
00061                 ACE_TEXT ("read_buffer"),
00062                 transport->id (),
00063                 bytes_read,
00064                 len));
00065 
00066   if (bytes_read == -1 && errno == ECONNRESET)
00067     {
00068       // @@ Is this OK??
00069 
00070       // We got a connection reset (TCP RSET) from the other side,
00071       // i.e., they didn't initiate a proper shutdown.
00072       //
00073       // Make it look like things are OK to the upper layer.
00074       bytes_read = 0;
00075       errno = 0;
00076     }
00077 
00078   return bytes_read;
00079 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL int TAO_GIOP_Utils::read_bytes_input TAO_Transport transport,
TAO_InputCDR cdr,
CORBA::ULong  buf_size,
ACE_Time_Value value = 0
[static]
 

Definition at line 15 of file GIOP_Utils.cpp.

References ACE_InputCDR::grow(), ACE_InputCDR::rd_ptr(), TAO_Transport::recv(), and ssize_t.

00019 {
00020   // Grow the size of CDR stream
00021   if (input.grow (read_size) == -1)
00022     return -1;
00023 
00024   // Read until all the header is received.  There should be no
00025   // problems with locking, the header is only a few bytes so they
00026   // should all be available on the socket, otherwise there is a
00027   // problem with the underlying transport, in which case we have more
00028   // problems than just this small loop.
00029   char *buf = input.rd_ptr ();
00030   ssize_t n = 0;
00031 
00032   for (CORBA::ULong t = read_size;
00033        t != 0;
00034        t -= n)
00035     {
00036       n = transport->recv (buf, t, value);
00037       if (n == -1)
00038         return -1;
00039       else if (n == 0) // @@ TODO && errno != EWOULDBLOCK)
00040         return -1;
00041       buf += n;
00042     }
00043 
00044   return 1;
00045 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:14:18 2006 for TAO by doxygen 1.3.6