TimeoutError:[WinError 10060]连接尝试失败,因为连接方在一段时间后没有正确响应

时间:2018-05-11 14:30:10

标签: python sockets tcp udp

我正在尝试连接到服务器,这是我的一段代码

import socket
HOST = '192.168.10.11'
PORT = 5060
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

我得到以下TimeoutError

   Traceback (most recent call last):
   File "D:Trails/calltest.py", line 7, in <module>
    s.connect((HOST, PORT))
   TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

我尝试了端口是否正常工作

~# nmap -p 5060 -sU -P0 192.168.10.11

我收到了回复

Starting Nmap 6.40 ( http://nmap.org ) at 2018-05-11 19:44 IST
Nmap scan report for 192.168.10.11
Host is up.
PORT     STATE         SERVICE
5060/udp open|filtered sip

为什么我无法连接?任何帮助表示赞赏!

0 个答案:

没有答案