tcp

In python is there a cross-platform way of determining what process is listening to a given port?

落爺英雄遲暮 提交于 2021-01-27 17:42:57
问题 In linux, I can use lsof -i as in the following function: def FindProcessUsingPort(portnum): import os fp = os.popen("lsof -i :%s" % portnum) lines = fp.readlines() fp.close() pid = None if len(lines) >= 2: pid = int(lines[1].split()[1]) return pid Is there a cross-platform way to figure this out? As a relevant reference, once I know the process id, the psutil library is very nice and lets me determine all sorts of useful process information for it in a cross-platform way. I just can't get

golang get massive read tcp ip:port i/o timeout in ubuntu 14.04 LTS

久未见 提交于 2021-01-27 12:42:27
问题 I wrote a golang program which run well in the past several months in ubuntu 12.04 LTS until I upgraded it to 14.04 LTS My program is focused on sending HTTP requests which send about 2-10 HTTP requests per second. The HTTP request address vary. When the problem occurs, first, some of the requests shows read tcp [ip]:[port]: i/o timeout , then after several minutes all requests show read tcp [ip]:[port]: i/o timeout , not any request can be sent. I restart the program, everything become right

C++ Linux Google Protobuf + boost::asio Cannot Parse

大兔子大兔子 提交于 2021-01-27 12:14:31
问题 I am trying to send a Google Protobuf message over a boost::asio socket via TCP. I recognize that TCP is a streaming protocol and thus I am performing length-prefixing on the messages before they go through the socket. I have the code working, but it only appears to work some of the time, even though I'm repeating the same calls and not changing the environment. On occasion I will receive the following error: [libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type

Why is Android dropping TCP packets, occurs in droid 5.x, not in 4.x?

ぃ、小莉子 提交于 2021-01-27 06:48:03
问题 I have an android smartphone connecting via WIFI to an embedded AP. I am sniffing WIFI traffic with a laptop running Tshark on Linux. I am transferring small (234 bytes) TCP packets 5 times every 100ms, followed by 500ms with no data. Periodically, packets will be ignored, forcing retransmission. Some level of packet retransmission is expected when transferring data over TCP sockets, but this is excessive. Especially so because the packets are received by the sniffer without problem (i.e.,

istio-proxy closing long running TCP connection after 1 hour

与世无争的帅哥 提交于 2021-01-27 06:42:50
问题 TL;DR: How can we configure istio sidecar injection/istio-proxy/envoy-proxy/istio egressgateway to allow long living (>3 hours), possibly idle, TCP connections? Some details: We're trying to perform a database migration to PostgreSQL which is being triggered by one application which has Spring Boot + Flyway configured, this migration is expected to last ~3 hours. Our application is deployed inside our kubernetes cluster, which has configured istio sidecar injection. After exactly one hour of

How to set linux kernel not to send RST_ACK, so that I can give SYN_ACK within raw socket

时光怂恿深爱的人放手 提交于 2021-01-27 06:21:33
问题 I want to ask a classic question about raw socket programming and linux kernel TCP handling. I've done the research to some same threads like linux raw socket programming question, How to reproduce TCP protocol 3-way handshake with raw sockets correctly?, and TCP ACK spoofing, but still can't get the solution. I try to make a server which don't listen to any port, but sniff SYN packets from remote hosts. After the server do some calculation, it will send back a SYN_ACK packet to corresponding

How to set linux kernel not to send RST_ACK, so that I can give SYN_ACK within raw socket

馋奶兔 提交于 2021-01-27 06:20:35
问题 I want to ask a classic question about raw socket programming and linux kernel TCP handling. I've done the research to some same threads like linux raw socket programming question, How to reproduce TCP protocol 3-way handshake with raw sockets correctly?, and TCP ACK spoofing, but still can't get the solution. I try to make a server which don't listen to any port, but sniff SYN packets from remote hosts. After the server do some calculation, it will send back a SYN_ACK packet to corresponding

How can you re-use or reconnect to a socket on the same port after disconnect?

大城市里の小女人 提交于 2021-01-27 05:57:24
问题 I am doing a simple project involving a single server program and a single client program. It needs to check if the client is connected (from the server side) and vice-versa for the client. When the client loses internet, the server needs to know it is disconnected. Then, the client needs to reconnect to the server when it regains internet When the client loses internet and then regains internet, I can't reconnect using the same port. I tried leaving the server listening and not shutting the

How to know if sendto() with TCP Fast Open actually used Fast Open?

核能气质少年 提交于 2021-01-27 04:48:39
问题 I write a TCP client on a Linux 3.15 machine, which is able to use TCP Fast Open: status = sendto(sd, (const void *) data, data_len, MSG_FASTOPEN, (const struct sockaddr *) hostref->ai_addr, sizeof(struct sockaddr_in)); if (status < 0) { fprintf(stderr, "sendto: %s\n", strerror(errno)); exit(EXIT_FAILURE); } fprintf(stdout, "TFO connection successful to %s\n", text_of(hostref->ai_addr)); Using tcpdump, I can check the sending of the TCP Fast Open option and that it does bypass the 3-way

How to know if sendto() with TCP Fast Open actually used Fast Open?

佐手、 提交于 2021-01-27 04:48:18
问题 I write a TCP client on a Linux 3.15 machine, which is able to use TCP Fast Open: status = sendto(sd, (const void *) data, data_len, MSG_FASTOPEN, (const struct sockaddr *) hostref->ai_addr, sizeof(struct sockaddr_in)); if (status < 0) { fprintf(stderr, "sendto: %s\n", strerror(errno)); exit(EXIT_FAILURE); } fprintf(stdout, "TFO connection successful to %s\n", text_of(hostref->ai_addr)); Using tcpdump, I can check the sending of the TCP Fast Open option and that it does bypass the 3-way