Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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 Methods

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 130 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 51 of file GIOP_Utils.cpp.

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

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

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 17 of file GIOP_Utils.cpp.

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

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


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:17:59 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002