# /confdConfig/capi/connectTimeout (xs:duration) \[PT60S\]

**URL:** https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758
**Category:** CDB and CDB API
**Created:** [February 3, 2018, 7:51am UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758 "2018-02-03T07:51:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sunxa](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@sunxa](https://dmap-community.ductus.global/u/sunxa)
#### Post date: [February 3, 2018, 7:51am UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758/1 "2018-02-03T07:51:32Z")

</div>

Hi  
Can you further explain the **/confdConfig/cli/multiPatternOperation and /confdConfig/capi/objectCacheTimeout** in confd guide?

Tt is better to take an example

Thanks

---

<div class="post-metadata">

### Author: ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)
#### Post date: [February 6, 2018, 12:19pm UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758/2 "2018-02-06T12:19:13Z")

</div>

> [@sunxa](#):
>
> /confdConfig/cli/multiPatternOperation

```auto
$ cat confd.conf | grep "<multiPatternOperation>"
    <multiPatternOperation>any</multiPatternOperation>
$ show arp arpe | select published false | select permanent false
Address Interface HW Address Permant Published
=================================================================
10.0.0.1 ethernet - 0:50:59:85:1c:28 false true     
10.0.0.2 ethernet - 0:50:59:85:1c:30 false true     
192.168.0.2 gignet - 0:51:59:85:1c:30 false true

```

```auto
$ cat confd.conf | grep "<multiPatternOperation>"
    <multiPatternOperation>all</multiPatternOperation>
$ show arp arpe | select published false | select permanent false
Address Interface HW Address Permant Published
=================================================================
% 0 entries in the table.

```

> [@sunxa](#):
>
> /confdConfig/capi/objectCacheTimeout

Register data provider with for example a get\_next\_object() callback that return a large list. Set the objectCacheTimeout to something “small”. Do some parsing of the returned list like in the CLI select example above. If the object cache timeout, the remaining values to be filtered will be fetched again by ConfD from the data provider.

> [@sunxa](#):
>
> /confdConfig/capi/connectTimeout

Connect a socket to the ConfD IPC port without calling cdb\_connect(). Wait until the timeout expires. The socket is disconnected by ConfD.

---

<div class="post-metadata">

### Author: ![sunxa](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@sunxa](https://dmap-community.ductus.global/u/sunxa)
#### Post date: [February 7, 2018, 7:54am UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758/3 "2018-02-07T07:54:37Z")

</div>

> [@cohult](#):
>
> Connect a socket to the ConfD IPC port without calling cdb\_connect(). Wait until the timeout expires. The socket is disconnected by ConfD.

Hi  
Thank you very much for your answer！  
I am still have some doubt about the result, according to your answer, i use function of “connect()” to connect confd, code as below:

```auto

#include <stdlib.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <time.h>
int main()
{
    time_t t;
    int cfd;
    int recbytes;
    int sin_size;
    char buffer[1024]= {0};
    struct sockaddr_in s_add,c_add;
    unsigned short portnum=4565;

    printf("Hello,welcome to client !\r\n");

    cfd = socket(PF_INET, SOCK_STREAM, 0);
    if(-1 == cfd) 
    {
        printf("socket fail ! \r\n");
        return -1;
    }
    printf("socket ok !\r\n");

    bzero(&s_add,sizeof(struct sockaddr_in));
    s_add.sin_family=AF_INET;
    s_add.sin_addr.s_addr= inet_addr("127.0.0.1");
    s_add.sin_port=htons(portnum);
    printf("s_addr = %#x ,port : %#x\r\n",s_add.sin_addr.s_addr,s_add.sin_port);

    if(-1 == connect(cfd,(struct sockaddr *)(&s_add), sizeof(struct sockaddr)))
    {
        printf("connect fail !\r\n");
        return -1;
    }

    printf("connect ok !\r\n");
    time(&t);
    printf("%s",ctime(&t));

    if(-1 == (recbytes = read(cfd,buffer,1024)))
    {
        printf("read data fail !\r\n");
        return -1;
    }

    time(&t);
    printf("%s",ctime(&t));

    printf("read ok\r\nREC:\r\n");

    buffer[recbytes]='\0';
    printf("read len[%d]: %s\r\n",recbytes,buffer);

    getchar();
    close(cfd);
    return 0;
}

```

`
run the code, result as below: the connect only last five seconds, and then disconnected whenever the value of “/confdConfig/capi/connectTimeout” is set.
[root@-]# gcc -o client client.c
[root@-]# ./client
Hello,welcome to client !
socket ok !
s_addr = 0x100007f ,port : 0xd511
connect ok !
Wed Feb 7 15:11:20 2018
Wed Feb 7 15:11:25 2018
read ok
REC:
read len[0]: 

we can also capture package , found: The socket is disconnected by ConfD after five seconds .

Question: My experiment is correct or not ? Why the “/confdConfig/capi/connectTimeout” does no take effect?
Thanks`

---

<div class="post-metadata">

### Author: ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)
#### Post date: [February 7, 2018, 4:36pm UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758/4 "2018-02-07T16:36:05Z")

</div>

Check your Linux TCP socket connect timeout etc. Maybe you have a firewall blocking the communication?

---

<div class="post-metadata">

### Author: ![per](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@per](https://dmap-community.ductus.global/u/per)
#### Post date: [February 7, 2018, 5:24pm UTC](https://dmap-community.ductus.global/t/confdconfig-capi-connecttimeout-xs-duration-pt60s/1758/5 "2018-02-07T17:24:41Z")

</div>

Actually there are several timeouts coming into play. confd\_connect(CONTROL\_SOCKET) will, after the socket connect(2) completes, a) tell the ConfD IPC port server “I want to talk to the DP-API component” (a.k.a. “capi”), and b) tell the DP-API component “This is the control socket for a daemon called xxxx”. There is a hardwired 5 second timeout when the IPC port server waits for a), and the connectTimeout is applied when the DP-API component waits for b). Bottom line, there is very little point in doing anything at all with the connectTimeout setting.
