Python 使用代理连接到 IRC 服务器

问题描述 投票:0回答:1

我正在尝试使用socks代理连接到IRC服务器以进行测试。 在撰写本文时,Socks 代理还处于活动状态。我已经使用代理检查器对其进行了检查,甚至使用 mIRC 选项中的代理地址和端口连接到 IRC 服务器,一切正常。

但是我无法通过Python连接到IRC服务器:

import socks
import time

proxy_type = socks.PROXY_TYPE_SOCKS4
proxy = '192.111.135.17'
port =  18302

network = "irc.icqchat.net"
port = 6667

irc = socks.socksocket()
irc.setproxy(proxy_type, proxy, port)

irc.connect((network, port))    

print (irc.recv ( 4096 ))
irc.send(bytes(  'NICK  test_connection \r\n' , "UTF-8"))
irc.send(bytes(  'USER botty botty botty :Sup\r\n' , "UTF-8"))
irc.send(bytes(  'JOIN  #testing \r\n' , "UTF-8"))
time.sleep(4)

代理连接要么拒绝工作(直接用我的真实IP连接我)要么返回错误:

socks.ProxyConnectionError: Error connecting to SOCKS4 proxy 192.111.135.17:6667: [WinError 10060] the attempt to establish the connection was unsuccessful, because From another computer, the desired response was not received for the required time, or the already installed connection was torn due to the incorrect response of the already connected computer 

我用不同的SOCK4和SOCKS5代理检查过,仍然没有结果。我的代码示例中是否存在错误,或者这是袜子库的已知问题?

python websocket proxy socks pysocks
1个回答
0
投票

这是一个网络错误,意味着你的计算机,或者可能是Python,无法连接到代理服务器。现在,既然您检查了计算机上的代理,我假设它们可以工作,您可以尝试使用我创建的库 sockslib 作为 pysocks 的替代品,因为该库已经有一段时间没有更新或维护了。

© www.soinside.com 2019 - 2024. All rights reserved.