Sockets with Tor and Python

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

链接地址: http://www.djcxy.com/p/56436.html

上一篇: 关闭后重新连接客户端到服务器

下一篇: 带有Tor和Python的套接字