Can't immediately receive multiple notifications in Npgsql

前端 未结 2 1859
离开以前
离开以前 2021-01-03 10:36

Today i wrote the following code that works with PostgreSQL C# library named Npgsql:

using System;
using System.Collections.Generic;
using System.Linq;
using         


        
2条回答
  •  Happy的楠姐
    2021-01-03 11:15

    Unless your client library supports checking the network socket for buffered data, the only way to receive notifications is to trigger some other activity on the socket.

    Many applications periodically send an empty query string ("") to do this.

    If the client library supports it and you are not using SSL, it might be possible to periodically call some kind of checkForNotifications() function on the connection. This is possible in PgJDBC, but I don't know nPgSQL, so I can only advise you to check out the documentation for that.

提交回复
热议问题