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

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 Methods

 ACE_SOCK_Connector (void)
 Default constructor. More...

 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)
 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 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. More...

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. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

int shared_open (ACE_SOCK_Stream &new_stream, int protocol_family, int protocol, int reuse_addr)
 Perform operations that ensure the socket is opened using BSD-style semantics (no QoS). More...

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)
 Perform operations that ensure the socket is opened using QoS-enabled semantics. More...

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>. More...

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>. More...


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 40 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 275 of file SOCK_Connector.h.

typedef ACE_SOCK_Stream ACE_SOCK_Connector::PEER_STREAM
 

Reimplemented in ACE_LSOCK_Connector.

Definition at line 276 of file SOCK_Connector.h.


Constructor & Destructor Documentation

ASYS_INLINE ACE_SOCK_Connector::ACE_SOCK_Connector void   
 

Default constructor.

Definition at line 18 of file SOCK_Connector.i.

References ACE_TRACE.

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

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
 

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.
Returns:
Returns 0 if the connection succeeds. If it fails, -1 is returned and errno contains a specific error code.

Definition at line 270 of file SOCK_Connector.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, connect, ETIME, ETIMEDOUT, EWOULDBLOCK, and LM_ERROR.

00277 {
00278   ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector");
00279 
00280   if (this->connect (new_stream,
00281                      remote_sap,
00282                      timeout,
00283                      local_sap,
00284                      reuse_addr,
00285                      flags,
00286                      perms) == -1
00287       && timeout != 0
00288       && !(errno == EWOULDBLOCK || errno == ETIME || errno == ETIMEDOUT))
00289     ACE_ERROR ((LM_ERROR,
00290                 ACE_LIB_TEXT ("%p\n"),
00291                 ACE_LIB_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector")));
00292 }

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.
Returns:
Returns 0 if the connection succeeds. If it fails, -1 is returned and errno contains a specific error code.

Definition at line 295 of file SOCK_Connector.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_SOCK_GROUP, ACE_TRACE, connect, ETIME, ETIMEDOUT, EWOULDBLOCK, and LM_ERROR.

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

ASYS_INLINE ACE_SOCK_Connector::~ACE_SOCK_Connector void   
 

Default dtor.

Definition at line 10 of file SOCK_Connector.i.

References ACE_TRACE.

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


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 218 of file SOCK_Connector.cpp.

References ACE_NON_BLOCKING_BUG_DELAY, 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, and ACE_OS::sleep.

Referenced by ACE_ATM_Connector::complete, and shared_connect_finish.

00221 {
00222   ACE_TRACE ("ACE_SOCK_Connector::complete");
00223   ACE_HANDLE h = ACE::handle_timed_complete (new_stream.get_handle (),
00224                                              tv);
00225   // We failed to get connected.
00226   if (h == ACE_INVALID_HANDLE)
00227     {
00228 #if defined (ACE_WIN32)
00229       // Win32 has a timing problem - if you check to see if the
00230       // connection has completed too fast, it will fail - so wait
00231       // <ACE_NON_BLOCKING_BUG_DELAY> microseconds to let it catch up
00232       // then retry to see if it's a real failure.
00233       ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY);
00234       ACE_OS::sleep (time);
00235       h = ACE::handle_timed_complete (new_stream.get_handle (),
00236                                       tv);
00237       if (h == ACE_INVALID_HANDLE)
00238         {
00239 #endif /* ACE_WIN32 */
00240       // Save/restore errno.
00241       ACE_Errno_Guard error (errno);
00242       new_stream.close ();
00243       return -1;
00244 #if defined (ACE_WIN32)
00245         }
00246 #endif /* ACE_WIN32 */
00247     }
00248 
00249   if (remote_sap != 0)
00250     {
00251       int len = remote_sap->get_size ();
00252       sockaddr *addr = ACE_reinterpret_cast (sockaddr *,
00253                                              remote_sap->get_addr ());
00254       if (ACE_OS::getpeername (h,
00255                                addr,
00256                                &len) == -1)
00257         {
00258           // Save/restore errno.
00259           ACE_Errno_Guard error (errno);
00260           new_stream.close ();
00261           return -1;
00262         }
00263     }
00264 
00265   // Start out with non-blocking disabled on the <new_stream>.
00266   new_stream.disable (ACE_NONBLOCK);
00267   return 0;
00268 }

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 177 of file SOCK_Connector.cpp.

References ACE_SOCK_GROUP, ACE_TRACE, ACE_OS::connect, ACE_Addr::get_addr, ACE_IPC_SAP::get_handle, ACE_Addr::get_size, ACE_Addr::get_type, shared_connect_finish, shared_connect_start, and shared_open.

00187 {
00188   ACE_TRACE ("ACE_SOCK_Connector::connect");
00189 
00190   if (this->shared_open (new_stream,
00191                          remote_sap.get_type (),
00192                          0,
00193                          protocolinfo,
00194                          g,
00195                          flags,
00196                          reuse_addr) == -1)
00197     return -1;
00198   else if (this->shared_connect_start (new_stream,
00199                                        timeout,
00200                                        local_sap) == -1)
00201     return -1;
00202 
00203   int result = ACE_OS::connect (new_stream.get_handle (),
00204                                 ACE_reinterpret_cast (sockaddr *,
00205                                                       remote_sap.get_addr ()),
00206                                 remote_sap.get_size (),
00207                                 qos_params);
00208 
00209   return this->shared_connect_finish (new_stream,
00210                                       timeout,
00211                                       result);
00212 }

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
 

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.
Returns:
Returns 0 if the connection succeeds. If it fails, -1 is returned and errno contains a specific error code.

Definition at line 145 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, shared_connect_finish, shared_connect_start, and shared_open.

Referenced by ACE_SOCK_Connector, ACE_MEM_Connector::connect, ACE_LSOCK_Connector::connect, ACE_ATM_Connector::connect, ACE_TSS_Connection::make_TSS_TYPE, ACE_Pipe::open, ACE_Name_Proxy::open, and ACE_Log_Msg_IPC::open.

00152 {
00153   ACE_TRACE ("ACE_SOCK_Connector::connect");
00154 
00155   if (this->shared_open (new_stream,
00156                          remote_sap.get_type (),
00157                          0,
00158                          reuse_addr) == -1)
00159     return -1;
00160   else if (this->shared_connect_start (new_stream,
00161                                        timeout,
00162                                        local_sap) == -1)
00163     return -1;
00164 
00165   int result = ACE_OS::connect (new_stream.get_handle (),
00166                                 ACE_reinterpret_cast (sockaddr *,
00167                                                       remote_sap.get_addr ()),
00168                                 remote_sap.get_size ());
00169 
00170   return this->shared_connect_finish (new_stream,
00171                                       timeout,
00172                                       result);
00173 }

void ACE_SOCK_Connector::dump void    const
 

Dump the state of an object.

Reimplemented in ACE_LSOCK_Connector.

Definition at line 22 of file SOCK_Connector.cpp.

References ACE_TRACE.

Referenced by ACE_Name_Proxy::dump.

00023 {
00024   ACE_TRACE ("ACE_SOCK_Connector::dump");
00025 }

ASYS_INLINE int ACE_SOCK_Connector::reset_new_handle ACE_HANDLE    handle
 

Resets any event associations on this handle.

Definition at line 24 of file SOCK_Connector.i.

References WSAEventSelect.

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

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 104 of file SOCK_Connector.cpp.

References ACE_NONBLOCK, ACE_TRACE, ACE_SOCK_Stream::close, complete, ACE_IPC_SAP::disable, EINPROGRESS, EISCONN, ETIMEDOUT, EWOULDBLOCK, ACE_Time_Value::sec, and ACE_Time_Value::usec.

Referenced by connect.

00107 {
00108   ACE_TRACE ("ACE_SOCK_Connector::shared_connect_finish");
00109   // Save/restore errno.
00110   ACE_Errno_Guard error (errno);
00111 
00112   if (result == -1 && timeout != 0)
00113     {
00114       // Check whether the connection is in progress.
00115       if (error == EINPROGRESS || error == EWOULDBLOCK)
00116         {
00117           // This expression checks if we were polling.
00118           if (timeout->sec () == 0
00119               && timeout->usec () == 0)
00120             error = EWOULDBLOCK;
00121           // Wait synchronously using timeout.
00122           else if (this->complete (new_stream,
00123                                    0,
00124                                    timeout) == -1)
00125             error = errno;
00126           else
00127             return 0;
00128         }
00129     }
00130 
00131   // EISCONN is treated specially since this routine may be used to
00132   // check if we are already connected.
00133   if (result != -1 || error == EISCONN)
00134     // Start out with non-blocking disabled on the <new_stream>.
00135     new_stream.disable (ACE_NONBLOCK);
00136   else if (!(error == EWOULDBLOCK || error == ETIMEDOUT))
00137     new_stream.close ();
00138 
00139   return result;
00140 }

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 72 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.

Referenced by connect.

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

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 47 of file SOCK_Connector.cpp.

References ACE_SOCK_GROUP, ACE_TRACE, ACE_IPC_SAP::get_handle, and ACE_SOCK::open.

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

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 28 of file SOCK_Connector.cpp.

References ACE_TRACE, ACE_IPC_SAP::get_handle, and ACE_SOCK::open.

Referenced by connect.

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


Member Data Documentation

ACE_SOCK_Connector::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_LSOCK_Connector.

Definition at line 282 of file SOCK_Connector.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:20 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002