|
Actively connect to a peer, producing a connected ACE_MEM_Stream object if the connection succeeds. -
Parameters:
-
new_stream |
The ACE_MEM_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. |
-
Note:
-
remote_sap must be an address on the local host.
-
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.
|