---
name: "ACE_Connect_Strategy"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Connect_Strategy"
---

# ACE\_Connect\_Strategy(3)

Defines the interface for specifying an active connection establishment strategy for a SVC\_HANDLER.

## NAME

ACE\_Connect\_Strategy -  Defines the interface for specifying an active connection establishment strategy for a SVC\_HANDLER.

## SYNOPSIS

```
#include <ace/ACE_Strategies_T.h>
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
class ACE_Connect_Strategy
{
  public:
    ACE_Connect_Strategy (void);
    virtual ACE_PEER_CONNECTOR &connector (void) const;
    virtual ~ACE_Connect_Strategy (void);
    virtual int connect_svc_handler (
        SVC_HANDLER *&sh,
        const ACE_PEER_CONNECTOR_ADDR &remote_addr,
        ACE_Time_Value *timeout,
        const ACE_PEER_CONNECTOR_ADDR &local_addr,
        int reuse_addr,
        int flags,
        int perms
        );
    virtual int connect_svc_handler (
        SVC_HANDLER *&sh,
        SVC_HANDLER *&sh_copy,
        const ACE_PEER_CONNECTOR_ADDR &remote_addr,
        ACE_Time_Value *timeout,
        const ACE_PEER_CONNECTOR_ADDR &local_addr,
        int reuse_addr,
        int flags,
        int perms
        );
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    ACE_PEER_CONNECTOR connector_;
};
```

## DESCRIPTION

This class provides a strategy that manages active connection establishment to a server.

## Initialization and termination methods.

```
ACE_Connect_Strategy (void);
```

Default constructor.

```
virtual ACE_PEER_CONNECTOR &connector (void) const;
```

Return a reference to the peer\_connector\_.

```
virtual ~ACE_Connect_Strategy (void);
```

## Factory method.

```
virtual int connect_svc_handler (
    SVC_HANDLER *&sh,
    const ACE_PEER_CONNECTOR_ADDR &remote_addr,
    ACE_Time_Value *timeout,
    const ACE_PEER_CONNECTOR_ADDR &local_addr,
    int reuse_addr,
    int flags,
    int perms
    );
```

The default behavior delegates to the connect method of the PEER\_CONNECTOR::connect.

```
virtual int connect_svc_handler (
    SVC_HANDLER *&sh,
    SVC_HANDLER *&sh_copy,
    const ACE_PEER_CONNECTOR_ADDR &remote_addr,
    ACE_Time_Value *timeout,
    const ACE_PEER_CONNECTOR_ADDR &local_addr,
    int reuse_addr,
    int flags,
    int perms
    );
```

The default behavior delegates to the connect method of the PEER\_CONNECTOR::connect. Please check the documentation in Connector.h for more details.

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
