zoukankan      html  css  js  c++  java
  • PQsocket 函数的简单验证

    程序逻辑大致如下:

        /* Make a connection to the database */
        conn = PQconnectdb(conninfo);
    
        /* Check to see that the backend connection was successfully made */
        if (PQstatus(conn) != CONNECTION_OK)
        {
            fprintf(stderr, "Connection to database failed: %s",
                    PQerrorMessage(conn));
            exit_nicely(conn);
        }
    
        /*
        * Sleep until something happens on the connection.  We use select(2)
        * to wait for input, but you could also use poll() or similar
        * facilities.
        */
        sock = PQsocket(conn);
        fprintf(stderr, "PQsocket result is: %d\n",sock);
    
        /* close the connection to the database and cleanup */
        PQfinish(conn);

    PQscoket 的中文解释:获取用于后端联接套接字的文件描述符。

    在我的机器上运行几次的结果都是 3

  • 相关阅读:
    condition精准控制
    Juc(上)
    算法和空间复杂度分析
    ReentrantLock
    死锁
    互斥锁
    线程常用方法
    多线程售票与同步机制
    线程的7种状态
    selenium 自动刷司法课
  • 原文地址:https://www.cnblogs.com/gaojian/p/2589737.html
Copyright © 2011-2022 走看看