tcp

Psycopg2 db connection hangs on lost network connection

痞子三分冷 提交于 2021-02-04 17:10:02
问题 Problem description I'm using psycopg2 to connect to my PostgreSQL database on a remote host. I open a connection and wait for requests, then for each request I run queries on the connection and return data. But when the network connection is lost after the connection is already open the next db query hangs and I have to kill the program manually. Details: it hangs for at least 2 hours (I couldn't wait longer) the "network down" situation is actually VPN going down (db host is accesible only

Psycopg2 db connection hangs on lost network connection

梦想与她 提交于 2021-02-04 17:06:34
问题 Problem description I'm using psycopg2 to connect to my PostgreSQL database on a remote host. I open a connection and wait for requests, then for each request I run queries on the connection and return data. But when the network connection is lost after the connection is already open the next db query hangs and I have to kill the program manually. Details: it hangs for at least 2 hours (I couldn't wait longer) the "network down" situation is actually VPN going down (db host is accesible only

Psycopg2 db connection hangs on lost network connection

巧了我就是萌 提交于 2021-02-04 17:05:42
问题 Problem description I'm using psycopg2 to connect to my PostgreSQL database on a remote host. I open a connection and wait for requests, then for each request I run queries on the connection and return data. But when the network connection is lost after the connection is already open the next db query hangs and I have to kill the program manually. Details: it hangs for at least 2 hours (I couldn't wait longer) the "network down" situation is actually VPN going down (db host is accesible only

sending multiple send/recv in socket

拥有回忆 提交于 2021-02-04 16:47:24
问题 I need bit clarification on using multiple send/recv in socket programs. My client program looks below(Using TCP SOCK_STREAM). send(sockfd,"Messgfromlient",15,0); send(sockfd,"cli1",5,0); send(sockfd,"cli2",5,0); send(sockfd,"cli3",5,0); send(sockfd,"cli4",5,0); send(sockfd,"cli5",5,0); and the server program looks like below. recv(newsockfd,buf,20,0); printf("Buffer is %s\n",buf); when i execute the above program, the output is as below: Client Msg :Messgfromlient I believe that the buf size

sending multiple send/recv in socket

旧巷老猫 提交于 2021-02-04 16:46:55
问题 I need bit clarification on using multiple send/recv in socket programs. My client program looks below(Using TCP SOCK_STREAM). send(sockfd,"Messgfromlient",15,0); send(sockfd,"cli1",5,0); send(sockfd,"cli2",5,0); send(sockfd,"cli3",5,0); send(sockfd,"cli4",5,0); send(sockfd,"cli5",5,0); and the server program looks like below. recv(newsockfd,buf,20,0); printf("Buffer is %s\n",buf); when i execute the above program, the output is as below: Client Msg :Messgfromlient I believe that the buf size

Deleted PostgreSQL user from mac, how to restore?

烂漫一生 提交于 2021-02-04 14:12:43
问题 I did something really stupid. I was running a postgreSQL on my mac, with a few databases in it. Recently I noticed a new user called PostgreSQL was added at my login screen, and I didn't find a better idea to remove this user. Now, my pgAdminIII doesn't connect to the server anymore, giving this error when I try to connect: Server doesn't listen The server doesn't accept connections: the connection library reports could not connect to server: Connection refused Is the server running on host

How to get amount of non-ACK-ed TCP data for the socket?

戏子无情 提交于 2021-02-04 12:22:18
问题 Linux has ioctl SIOCOUTQ described in man-page tcp(7) that returns amount of unsent data in socket buffers. If I understand kernel code right, all the non-ACKed data is counted as "unsent". The ioctl is available at least since 2.4.x. Is there anything alike for {Free,Net,Open,*}BSD, Solaris, Windows? 回答1: There are (at least) two different pieces of information you might want: the amount of data that hasn't been sent yet, and the amount of data that's been sent-but-not-ACK-ed. On Linux:

How to get amount of non-ACK-ed TCP data for the socket?

落爺英雄遲暮 提交于 2021-02-04 12:21:18
问题 Linux has ioctl SIOCOUTQ described in man-page tcp(7) that returns amount of unsent data in socket buffers. If I understand kernel code right, all the non-ACKed data is counted as "unsent". The ioctl is available at least since 2.4.x. Is there anything alike for {Free,Net,Open,*}BSD, Solaris, Windows? 回答1: There are (at least) two different pieces of information you might want: the amount of data that hasn't been sent yet, and the amount of data that's been sent-but-not-ACK-ed. On Linux: