LISTEN/NOTIFY problem - Mailing list pgsql-general

From Dmitri Girski
Subject LISTEN/NOTIFY problem
Date
Msg-id daed64560903230400s53cd45e7l7108feb3ace4ad48@mail.gmail.com
Whole thread Raw
Responses Re: LISTEN/NOTIFY problem
Re: LISTEN/NOTIFY problem
List pgsql-general
Hi everybody,

I've got a weird problem with LISTEN/NOTIFY.

My C++ app subscribes for the notifications, just like in libpq examples:

The only difference, that I am setting the timeout on select just to check if application wants to exit.

//open session

//subscribe

while(!exit)
{
    sock = PGsocket(conn)
     
    res = select(sock);

    if (res)

   //check if it timeout
   //or if there was a notification


}

The problem that I am facing is that after some time notifications stop coming.
select() returns on timeout and nothing else.

Just as a test a included UNLISTEN/LISTEN sequence into the loop, so after timeout or event application re-subscribes. And this helps.

The question is, what I am doing wrong with the code in the first place?

Any help is appreciated.

Cheers,
Dmitri.










--
@Gmail

pgsql-general by date:

Previous
From: Dave Page
Date:
Subject: Re: debugging in pgadmin
Next
From: josep porres
Date:
Subject: Re: debugging in pgadmin