ACE_SOCK_Connector Class Reference

Defines a factory that actively connects to a remote IP address and TCP port, creating a new ACE_SOCK_Stream object. More...

#include <SOCK_Connector.h>

Inheritance diagram for ACE_SOCK_Connector:

Inheritance graph
[legend]
List of all members.

Public Types

typedef ACE_INET_Addr PEER_ADDR
typedef ACE_SOCK_Stream PEER_STREAM

Public Member Functions

 ACE_SOCK_Connector (void)
 Default constructor.
 ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, const ACE_Addr &remote_sap, const ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0, int protocol=0)
 ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, const ACE_Addr &remote_sap, ACE_QoS_Params qos_params, const ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, ACE_Protocol_Info *protocolinfo=0, ACE_SOCK_GROUP g=0, u_long flags=0, int reuse_addr=0, int perms=0)
int connect (ACE_SOCK_Stream &new_stream, const ACE_Addr &remote_sap, const ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0, int protocol=0)
int connect (ACE_SOCK_Stream &new_stream, const ACE_Addr &remote_sap, ACE_QoS_Params qos_params, const ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, ACE_Protocol_Info *protocolinfo=0, ACE_SOCK_GROUP g=0, u_long flags=0, int reuse_addr=0, int perms=0)
 ~ACE_SOCK_Connector (void)
 Default dtor.
int complete (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_sap=0, const ACE_Time_Value *timeout=0)
int reset_new_handle (ACE_HANDLE handle)
 Resets any event associations on this handle.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Member Functions

int shared_open (ACE_SOCK_Stream &new_stream, int protocol_family, int protocol, int reuse_addr)
int shared_open (ACE_SOCK_Stream &new_stream, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr)
int shared_connect_start (ACE_SOCK_Stream &new_stream, const ACE_Time_Value *timeout, const ACE_Addr &local_sap)
 Perform operations that must be called before <ACE_OS::connect>.
int shared_connect_finish (ACE_SOCK_Stream &new_stream, const ACE_Time_Value *timeout, int result)
 Perform operations that must be called after <ACE_OS::connect>.

Detailed Description

Defines a factory that actively connects to a remote IP address and TCP port, creating a new ACE_SOCK_Stream object.

The ACE_SOCK_Connector doesn't have a socket of its own, i.e., it simply "borrows" the one from the ACE_SOCK_Stream that's being connected. The reason for this is that the underlying socket API doesn't use a factory socket to connect data mode sockets. Therefore, there's no need to inherit ACE_SOCK_Connector from ACE_SOCK. A nice side-effect of this is that ACE_SOCK_Connector objects do not store state so they can be used reentrantly in multithreaded programs.

Definition at line 43 of file SOCK_Connector.h.


Member Typedef Documentation

typedef ACE_INET_Addr ACE_SOCK_Connector::PEER_ADDR

Reimplemented in ACE_LSOCK_Connector.

Definition at line 276 of file SOCK_Connector.h.

typedef ACE_SOCK_Stream ACE_SOCK_Connector::PEER_STREAM

Reimplemented in ACE_LSOCK_Connector.

Definition at line 277 of file SOCK_Connector.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_SOCK_Connector::ACE_SOCK_Connector ( void   ) 

Default constructor.

Definition at line 19 of file SOCK_Connector.inl.

References ACE_TRACE.

00020 {
00021   ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
00022 }

ACE_SOCK_Connector::ACE_SOCK_Connector ( ACE_SOCK_Stream new_stream,
const ACE_Addr remote_sap,
const ACE_Time_Value timeout = 0,
const ACE_Addr local_sap = ACE_Addr::sap_any,
int  reuse_addr = 0,
int  flags = 0,
int  perms = 0,
int  protocol = 0 
)

Actively connect to a peer, producing a connected ACE_SOCK_Stream object if the connection succeeds.

Parameters:
new_stream The ACE_SOCK_Stream object that will be connected to the peer.
remote_sap The address that we are trying to connect to. The protocol family of remote_sap is used for the connected socket. That is, if remote_sap contains an IPv6 address, a socket with family PF_INET6 will be used, else it will be PF_INET.
timeout Pointer to an ACE_Time_Value object with amount of time to wait to connect. If the pointer is 0 then the call blocks until the connection attempt is complete, whether it succeeds or fails. If *timeout == {0, 0} then the connection is done using nonblocking mode. In this case, if the connection can't be made immediately, this method returns -1 and errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out; if the specified amount of time passes before the connection is made, this method returns -1 and errno == ETIME. Note the difference between this case and when a blocking connect is attmpted that TCP times out - in the latter case, errno will be ETIMEDOUT.
local_sap (optional) The local address to bind to. If it's the default value of ACE_Addr::sap_any then the OS will choose an unused port.
reuse_addr (optional) If the value is 1, the local address (local_sap) is reused, even if it hasn't been cleaned up yet.
flags Ignored.
perms Ignored.
protocol (optional) If value is 0, default SOCK_STREAM protocol is selected by kernel (typically TCP).

Definition at line 301 of file SOCK_Connector.cpp.

References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.

00309 {
00310   ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
00311 
00312   if (this->connect (new_stream,
00313                      remote_sap,
00314                      timeout,
00315                      local_sap,
00316                      reuse_addr,
00317                      flags,
00318                      perms,
00319                      protocol) == -1
00320       && timeout != 0
00321       && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT))
00322     ACE_ERROR ((LM_ERROR,
00323                 ACE_TEXT ("%p\n"),
00324                 ACE_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector")));
00325 }

ACE_SOCK_Connector::ACE_SOCK_Connector ( ACE_SOCK_Stream new_stream,
const ACE_Addr remote_sap,
ACE_QoS_Params  qos_params,
const ACE_Time_Value timeout = 0,
const ACE_Addr local_sap = ACE_Addr::sap_any,
ACE_Protocol_Info protocolinfo = 0,
ACE_SOCK_GROUP  g = 0,
u_long  flags = 0,
int  reuse_addr = 0,
int  perms = 0 
)

Actively connect to a peer, producing a connected ACE_SOCK_Stream object if the connection succeeds.

Parameters:
new_stream The ACE_SOCK_Stream object that will be connected to the peer.
remote_sap The address that we are trying to connect to. The protocol family of remote_sap is used for the connected socket. That is, if remote_sap contains an IPv6 address, a socket with family PF_INET6 will be used, else it will be PF_INET.
qos_params Contains QoS parameters that are passed to the IntServ (RSVP) and DiffServ protocols.
See also:
ACE_QoS_Params.
Parameters:
timeout Pointer to an ACE_Time_Value object with amount of time to wait to connect. If the pointer is 0 then the call blocks until the connection attempt is complete, whether it succeeds or fails. If *timeout == {0, 0} then the connection is done using nonblocking mode. In this case, if the connection can't be made immediately, this method returns -1 and errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out; if the specified amount of time passes before the connection is made, this method returns -1 and errno == ETIME. Note the difference between this case and when a blocking connect is attmpted that TCP times out - in the latter case, errno will be ETIMEDOUT.
local_sap (optional) The local address to bind to. If it's the default value of ACE_Addr::sap_any then the OS will choose an unused port.
reuse_addr (optional) If the value is 1, the local address (local_sap) is reused, even if it hasn't been cleaned up yet.
flags Ignored.
perms Ignored.

Definition at line 328 of file SOCK_Connector.cpp.

References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.

00338 {
00339   ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
00340 
00341   if (this->connect (new_stream,
00342                      remote_sap,
00343                      qos_params,
00344                      timeout,
00345                      local_sap,
00346                      protocolinfo,
00347                      g,
00348                      flags,
00349                      reuse_addr,
00350                      perms) == -1
00351       && timeout != 0
00352       && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT))
00353     ACE_ERROR ((LM_ERROR,
00354                 ACE_TEXT ("%p\n"),
00355                 ACE_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector")));
00356 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SOCK_Connector::~ACE_SOCK_Connector ( void   ) 

Default dtor.

Definition at line 11 of file SOCK_Connector.inl.

References ACE_TRACE.

00012 {
00013   ACE_TRACE ("ACE_SOCK_Connector::~ACE_SOCK_Connector");
00014 }


Member Function Documentation

int ACE_SOCK_Connector::complete ( ACE_SOCK_Stream new_stream,
ACE_Addr remote_sap = 0,
const ACE_Time_Value timeout = 0 
)

Try to complete a nonblocking connection that was begun by a previous call to connect with a {0, 0} ACE_Time_Value timeout.

See also:
connect().
Parameters:
new_stream The ACE_SOCK_Stream object that will be connected to the peer.
remote_sap If non-0, it points to the ACE_INET_Addr object that will contain the address of the connected peer.
timeout Same values and return value possibilites as for connect().
See also:
connect().

Definition at line 250 of file SOCK_Connector.cpp.

References ACE_NONBLOCK, ACE_TRACE, ACE_SOCK_Stream::close(), ACE_IPC_SAP::disable(), ACE_Addr::get_addr(), ACE_IPC_SAP::get_handle(), ACE_Addr::get_size(), ACE_OS::getpeername(), ACE::handle_timed_complete(), ACE_OS::sleep(), and ACE_OS::time().

00253 {
00254   ACE_TRACE ("ACE_SOCK_Connector::complete");
00255   ACE_HANDLE h = ACE::handle_timed_complete (new_stream.get_handle (),
00256                                              tv);
00257   // We failed to get connected.
00258   if (h == ACE_INVALID_HANDLE)
00259     {
00260 #if defined (ACE_WIN32)
00261       // Win32 has a timing problem - if you check to see if the
00262       // connection has completed too fast, it will fail - so wait
00263       // <ACE_NON_BLOCKING_BUG_DELAY> microseconds to let it catch up
00264       // then retry to see if it's a real failure.
00265       ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY);
00266       ACE_OS::sleep (time);
00267       h = ACE::handle_timed_complete (new_stream.get_handle (),
00268                                       tv);
00269       if (h == ACE_INVALID_HANDLE)
00270         {
00271 #endif /* ACE_WIN32 */
00272       // Save/restore errno.
00273       ACE_Errno_Guard error (errno);
00274       new_stream.close ();
00275       return -1;
00276 #if defined (ACE_WIN32)
00277         }
00278 #endif /* ACE_WIN32 */
00279     }
00280 
00281   if (remote_sap != 0)
00282     {
00283       int len = remote_sap->get_size ();
00284       sockaddr *addr = reinterpret_cast<sockaddr *> (remote_sap->get_addr ());
00285       if (ACE_OS::getpeername (h,
00286                                addr,
00287                                &len) == -1)
00288         {
00289           // Save/restore errno.
00290           ACE_Errno_Guard error (errno);
00291           new_stream.close ();
00292           return -1;
00293         }
00294     }
00295 
00296   // Start out with non-blocking disabled on the <new_stream>.
00297   new_stream.disable (ACE_NONBLOCK);
00298   return 0;
00299 }

int ACE_SOCK_Connector::connect ( ACE_SOCK_Stream new_stream,
const ACE_Addr remote_sap,
ACE_QoS_Params  qos_params,
const ACE_Time_Value timeout = 0,
const ACE_Addr local_sap = ACE_Addr::sap_any,
ACE_Protocol_Info protocolinfo = 0,
ACE_SOCK_GROUP  g = 0,
u_long  flags = 0,
int  reuse_addr = 0,
int  perms = 0 
)

Actively connect to a peer, producing a connected ACE_SOCK_Stream object if the connection succeeds.

Parameters:
new_stream The ACE_SOCK_Stream object that will be connected to the peer.
remote_sap The address that we are trying to connect to. The protocol family of remote_sap is used for the connected socket. That is, if remote_sap contains an IPv6 address, a socket with family PF_INET6 will be used, else it will be PF_INET.
qos_params Contains QoS parameters that are passed to the IntServ (RSVP) and DiffServ protocols.
See also:
ACE_QoS_Params.
Parameters:
timeout Pointer to an ACE_Time_Value object with amount of time to wait to connect. If the pointer is 0 then the call blocks until the connection attempt is complete, whether it succeeds or fails. If *timeout == {0, 0} then the connection is done using nonblocking mode. In this case, if the connection can't be made immediately, this method returns -1 and errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out; if the specified amount of time passes before the connection is made, this method returns -1 and errno == ETIME. Note the difference between this case and when a blocking connect is attmpted that TCP times out - in the latter case, errno will be ETIMEDOUT.
local_sap (optional) The local address to bind to. If it's the default value of ACE_Addr::sap_any then the OS will choose an unused port.
reuse_addr (optional) If the value is 1, the local address (local_sap) is reused, even if it hasn't been cleaned up yet.
flags Ignored.
perms Ignored.
Returns:
Returns 0 if the connection succeeds. If it fails, -1 is returned and errno contains a specific error code.

Definition at line 210 of file SOCK_Connector.cpp.

References ACE_TRACE, ACE_OS::connect(), ACE_Addr::get_addr(), ACE_IPC_SAP::get_handle(), ACE_Addr::get_size(), ACE_Addr::get_type(), and shared_connect_finish().

00220 {
00221   ACE_TRACE ("ACE_SOCK_Connector::connect");
00222 
00223   if (this->shared_open (new_stream,
00224                          remote_sap.get_type (),
00225                          0,
00226                          protocolinfo,
00227                          g,
00228                          flags,
00229                          reuse_addr) == -1)
00230     return -1;
00231   else if (this->shared_connect_start (new_stream,
00232                                        timeout,
00233                                        local_sap) == -1)
00234     return -1;
00235 
00236   int result = ACE_OS::connect (new_stream.get_handle (),
00237                                 reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
00238                                 remote_sap.get_size (),
00239                                 qos_params);
00240 
00241   return this->shared_connect_finish (new_stream,
00242                                       timeout,
00243                                       result);
00244 }

int ACE_SOCK_Connector::connect ( ACE_SOCK_Stream new_stream,
const ACE_Addr remote_sap,
const ACE_Time_Value timeout = 0,
const ACE_Addr local_sap = ACE_Addr::sap_any,
int  reuse_addr = 0,
int  flags = 0,
int  perms = 0,
int  protocol = 0 
)

Actively connect to a peer, producing a connected ACE_SOCK_Stream object if the connection succeeds.

Parameters:
new_stream The ACE_SOCK_Stream object that will be connected to the peer.
remote_sap The address that we are trying to connect to. The protocol family of remote_sap is used for the connected socket. That is, if remote_sap contains an IPv6 address, a socket with family PF_INET6 will be used, else it will be PF_INET.
timeout Pointer to an ACE_Time_Value object with amount of time to wait to connect. If the pointer is 0 then the call blocks until the connection attempt is complete, whether it succeeds or fails. If *timeout == {0, 0} then the connection is done using nonblocking mode. In this case, if the connection can't be made immediately, this method returns -1 and errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out; if the specified amount of time passes before the connection is made, this method returns -1 and errno == ETIME. Note the difference between this case and when a blocking connect is attmpted that TCP times out - in the latter case, errno will be ETIMEDOUT.
local_sap (optional) The local address to bind to. If it's the default value of ACE_Addr::sap_any then the OS will choose an unused port.
reuse_addr (optional) If the value is 1, the local address (local_sap) is reused, even if it hasn't been cleaned up yet.
flags Ignored.
perms Ignored.
protocol (optional) If value is 0, default SOCK_STREAM protocol is selected by kernel (typically TCP).
Returns:
Returns 0 if the connection succeeds. If it fails, -1 is returned and errno contains a specific error code.

Definition at line 178 of file SOCK_Connector.cpp.

References ACE_TRACE, ACE_OS::connect(), ACE_Addr::get_addr(), ACE_IPC_SAP::get_handle(), ACE_Addr::get_size(), ACE_Addr::get_type(), and shared_connect_finish().

Referenced by ACE_LSOCK_Connector::connect(), ACE_Pipe::open(), ACE_Name_Proxy::open(), and ACE_Log_Msg_IPC::open().

00186 {
00187   ACE_TRACE ("ACE_SOCK_Connector::connect");
00188 
00189   if (this->shared_open (new_stream,
00190                          remote_sap.get_type (),
00191                          protocol,
00192                          reuse_addr) == -1)
00193     return -1;
00194   else if (this->shared_connect_start (new_stream,
00195                                        timeout,
00196                                        local_sap) == -1)
00197     return -1;
00198 
00199   int result = ACE_OS::connect (new_stream.get_handle (),
00200                                 reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
00201                                 remote_sap.get_size ());
00202 
00203   return this->shared_connect_finish (new_stream,
00204                                       timeout,
00205                                       result);
00206 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_SOCK_Connector::dump ( void   )  const

Dump the state of an object.

Reimplemented in ACE_LSOCK_Connector.

Definition at line 25 of file SOCK_Connector.cpp.

References ACE_TRACE.

00026 {
00027 #if defined (ACE_HAS_DUMP)
00028   ACE_TRACE ("ACE_SOCK_Connector::dump");
00029 #endif /* ACE_HAS_DUMP */
00030 }

ACE_INLINE int ACE_SOCK_Connector::reset_new_handle ( ACE_HANDLE  handle  ) 

Resets any event associations on this handle.

Definition at line 25 of file SOCK_Connector.inl.

00026 {
00027 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00028   // Reset the event association
00029   return ::WSAEventSelect ((SOCKET) handle,
00030                            0,
00031                            0);
00032 #else /* !defined ACE_HAS_WINSOCK2 */
00033   ACE_UNUSED_ARG (handle);
00034   return 0;
00035 #endif /* ACE_WIN32 */
00036 }

int ACE_SOCK_Connector::shared_connect_finish ( ACE_SOCK_Stream new_stream,
const ACE_Time_Value timeout,
int  result 
) [protected]

Perform operations that must be called after <ACE_OS::connect>.

Definition at line 108 of file SOCK_Connector.cpp.

References ACE_NONBLOCK, ACE_TRACE, ACE_SOCK_Stream::close(), ACE_IPC_SAP::disable(), ACE_IPC_SAP::get_handle(), ACE::handle_timed_complete(), ACE_Time_Value::sec(), and ACE_Time_Value::usec().

Referenced by connect().

00111 {
00112   ACE_TRACE ("ACE_SOCK_Connector::shared_connect_finish");
00113   // Save/restore errno.
00114   ACE_Errno_Guard error (errno);
00115 
00116   if (result == -1 && timeout != 0)
00117     {
00118       // Check whether the connection is in progress.
00119       if (error == EINPROGRESS || error == EWOULDBLOCK)
00120         {
00121           // This expression checks if we were polling.
00122           if (timeout->sec () == 0
00123               && timeout->usec () == 0)
00124             {
00125 #if defined(ACE_WIN32)
00126               // In order to detect when the socket that has been
00127               // bound to is in TIME_WAIT we need to do the connect
00128               // (which will always return EWOULDBLOCK) and then do an
00129               // ACE::handle_timed_complete() (with timeout==0,
00130               // i.e. poll). This will do a select() on the handle
00131               // which will immediately return with the handle in an
00132               // error state. The error code is then retrieved with
00133               // getsockopt(). Good sockets however will return from
00134               // the select() with ETIME - in this case return
00135               // EWOULDBLOCK so the wait strategy can complete the
00136               // connection.
00137               if(ACE::handle_timed_complete (new_stream.get_handle (),
00138                                              timeout) == ACE_INVALID_HANDLE)
00139                 {
00140                   int const tmp = errno;
00141                   if (tmp != ETIME)
00142                     {
00143                       error = tmp;
00144                     }
00145                   else
00146                     error = EWOULDBLOCK;
00147                 }
00148               else
00149                 result = 0;
00150 #else  /* ACE_WIN32 */
00151               error = EWOULDBLOCK;
00152 #endif /* ACE_WIN32 */
00153             }
00154           // Wait synchronously using timeout.
00155           else if (this->complete (new_stream,
00156                                    0,
00157                                    timeout) == -1)
00158             error = errno;
00159           else
00160             return 0;
00161         }
00162     }
00163 
00164   // EISCONN is treated specially since this routine may be used to
00165   // check if we are already connected.
00166   if (result != -1 || error == EISCONN)
00167     // Start out with non-blocking disabled on the <new_stream>.
00168     new_stream.disable (ACE_NONBLOCK);
00169   else if (!(error == EWOULDBLOCK || error == ETIMEDOUT))
00170     new_stream.close ();
00171 
00172   return result;
00173 }

int ACE_SOCK_Connector::shared_connect_start ( ACE_SOCK_Stream new_stream,
const ACE_Time_Value timeout,
const ACE_Addr local_sap 
) [protected]

Perform operations that must be called before <ACE_OS::connect>.

Definition at line 77 of file SOCK_Connector.cpp.

References ACE_NONBLOCK, ACE_TRACE, ACE_OS::bind(), ACE_SOCK_Stream::close(), ACE_IPC_SAP::enable(), ACE_Addr::get_addr(), ACE_IPC_SAP::get_handle(), ACE_Addr::get_size(), and ACE_Addr::sap_any.

00080 {
00081   ACE_TRACE ("ACE_SOCK_Connector::shared_connect_start");
00082 
00083   if (local_sap != ACE_Addr::sap_any)
00084     {
00085       sockaddr *laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ());
00086       int size = local_sap.get_size ();
00087 
00088       if (ACE_OS::bind (new_stream.get_handle (),
00089                         laddr,
00090                         size) == -1)
00091         {
00092           // Save/restore errno.
00093           ACE_Errno_Guard error (errno);
00094           new_stream.close ();
00095           return -1;
00096         }
00097     }
00098 
00099   // Enable non-blocking, if required.
00100   if (timeout != 0
00101       && new_stream.enable (ACE_NONBLOCK) == -1)
00102     return -1;
00103   else
00104     return 0;
00105 }

int ACE_SOCK_Connector::shared_open ( ACE_SOCK_Stream new_stream,
int  protocol_family,
int  protocol,
ACE_Protocol_Info protocolinfo,
ACE_SOCK_GROUP  g,
u_long  flags,
int  reuse_addr 
) [protected]

Perform operations that ensure the socket is opened using QoS-enabled semantics.

Definition at line 52 of file SOCK_Connector.cpp.

References ACE_TRACE, ACE_IPC_SAP::get_handle(), ACE_SOCK::open(), and SOCK_STREAM.

00059 {
00060   ACE_TRACE ("ACE_SOCK_Connector::shared_open");
00061 
00062   // Only open a new socket if we don't already have a valid handle.
00063   if (new_stream.get_handle () == ACE_INVALID_HANDLE
00064       && new_stream.open (SOCK_STREAM,
00065                           protocol_family,
00066                           protocol,
00067                           protocolinfo,
00068                           g,
00069                           flags,
00070                           reuse_addr) == -1)
00071     return -1;
00072   else
00073     return 0;
00074 }

int ACE_SOCK_Connector::shared_open ( ACE_SOCK_Stream new_stream,
int  protocol_family,
int  protocol,
int  reuse_addr 
) [protected]

Perform operations that ensure the socket is opened using BSD-style semantics (no QoS).

Definition at line 33 of file SOCK_Connector.cpp.

References ACE_TRACE, ACE_IPC_SAP::get_handle(), ACE_SOCK::open(), and SOCK_STREAM.

00037 {
00038   ACE_TRACE ("ACE_SOCK_Connector::shared_open");
00039 
00040   // Only open a new socket if we don't already have a valid handle.
00041   if (new_stream.get_handle () == ACE_INVALID_HANDLE
00042       && new_stream.open (SOCK_STREAM,
00043                           protocol_family,
00044                           protocol,
00045                           reuse_addr) == -1)
00046     return -1;
00047   else
00048     return 0;
00049 }


Member Data Documentation

ACE_SOCK_Connector::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented in ACE_LSOCK_Connector.

Definition at line 283 of file SOCK_Connector.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:37 2010 for ACE by  doxygen 1.4.7