Tor 和 Python 的套接字
你好,我正在Python中构建一个IM P2P客户端/服务器,并想使用Tor作为代理,服务器使用线程运行,而客户端同时运行,
在本地系统上运行的服务器是否需要监听Tor?如果是这样我该怎么做?如何让客户端使用 Tor 连接到远程系统?
我搜索了一些示例,但它们导致了一个似乎很难下载的库
这是相关的服务器/客户端代码
#Client Connection s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((str(self.CLIENT_HOST).strip(), self.CLIENT_PORT))
#Server source_ip = '' #socket.gethostbyname(socket.gethostname()) PORT = 9001 ### Initialize socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind((source_ip, PORT)) # server_socket.listen(5)
任何想法都受到极大的欢迎和赞赏
Hello I am building an IM P2P client/server in Python and would like to use Tor as a proxy for it the server runs using Threads while the client runs at the same time
Does the server running on the local system need to listen to Tor? If so how do I do this? How do I make the client connect to a remote system using Tor?
I have searched for some examples but they lead to a library that seems to be really awkward to download
Here is the relevant server/client code
#Client Connection s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((str(self.CLIENT_HOST).strip(), self.CLIENT_PORT))
#Server source_ip = '' #socket.gethostbyname(socket.gethostname()) PORT = 9001 ### Initialize socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind((source_ip, PORT)) # server_socket.listen(5)
Any ideas are greatly welcomed and appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论