I am using the python websocket-client package (https://pypi.org/project/websocket-client/) to subscribe to multiple websocket channels. I implemented the basic ping-pong logic using the websocket client package as below. The ping-pong logic is working mostly fine under normal circumstances and I am able to run the code for hours without many disconnect/reconnect instances. However, when I try to increase the number of
Tag: ping
multiple ping script keeps pinging the same ips from one list several times
I have writen a simple code that should ping several ips at the same time using threading methode. It seems like the code is running well and able to execute the task but the problem is that the script keeps pinging the same ips several times, although the range for the threads set to be as the number of the
How to extract the output of a cmd query to a textfile using python
I have this simple python code; After running the code, a cmd window is displayed with the following result; How do I copy this code from the cmd window and save to a textfile using python? Answer I think the simplest solution would be forwarding the output into a file. ping -n 20 {ip_addr} >output.txt (do “>>” to append and
Pinging servers in Python
In Python, is there a way to ping a server through ICMP and return TRUE if the server responds, or FALSE if there is no response? Answer This function works in any OS (Unix, Linux, macOS, and Windows) Python 2 and Python 3 EDITS: By @radato os.system was replaced by subprocess.call. This avoids shell injection vulnerability in cases where your