Linked Questions
10 questions linked to/from Python socket connection timeout
1
vote
0
answers
56
views
Python library socket connect_ex, wait time [duplicate]
I am trying to do a port test using the python socket library.
The object uses connect_ex((ip,port)), and the result is immediately
displayed in case of success but waits for about 2 minutes in case ...
5
votes
2
answers
15k
views
Python Socket timeout error
I am writing a very simple udp socket connection in Python 2.7
The server side is up and running.
I have trouble on the client side.
from socket import *
serverName = '127.0.0.1'
serverPort = 5444
...
3
votes
1
answer
9k
views
Set correctly timeout when connection fails on Python socket
I'm starting to learn python socket and the TCP/IP model, so I'm at very beginning. I have this simple piece of code that works correctly as expected:
import socket
from datetime import datetime
s = ...
1
vote
2
answers
4k
views
Python TCP/IP Communication
This is my python modbus tcp communication code and it wait at the this line and than stopping for the connection where is my fault:
sock.connect((TCP_IP, TCP_PORT))
(if i use slave program also not ...
0
votes
3
answers
1k
views
Python Try and Except - The script get hung on the except
I have a small script that will check to see if a list of devices are either ssh or telnet enable.
Here is my code:
import socket
import sys
file = open('list', 'r')
file = file.readlines()
list = []...
amb1s1's user avatar
- 2,085
1
vote
1
answer
434
views
How do I loop ports to scan?
I have this problem with a portscanner which keeps hanging at scanning port 1. How can I solve this problem?
#! /usr/bin/env python
import socket
import subprocess
from datetime ...
0
votes
0
answers
153
views
Is it possible to set a timeout for socket.close()
I'm working with sockets and noticed my program gets 'stuck' sometimes when I'm trying to perform a socket.close(). Is it possible to set a timeout for how long socket.close() is allowed to take ...
0
votes
1
answer
105
views
Python Help - This isn't looping? (Sockets)
I'm having trouble with my code here, when I input a port range when it comes to a closed port the program will just pause. Its fine when it has open ports. Can anyone help?
#!/usr/bin/env python
...
2
votes
1
answer
138
views
What is the Python equivalent of RequestConfig in Java?
I have the following piece of code in Java:
RequestConfig.custom().setSocketTimeout(10).setConnectTimeout(20).build();
How do I achieve the same thing in Python?
user avatar
user6653200
0
votes
0
answers
52
views
socket.connect() freezing when there is no internet
I want to check if Google is reachable or not. I'm using this code:
import socket
def google_is_reachable():
try:
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...