コード例 #1
0
ファイル: network_test.py プロジェクト: wathiq-iq/Telethon
    def test_tcp_client():
        port = random.randint(50000, 60000)  # Arbitrary non-privileged port
        run_server_echo_thread(port)

        msg = b'Unit testing...'
        client = TcpClient()
        client.connect('localhost', port)
        client.write(msg)
        assert msg == client.read(
            16), 'Read message does not equal sent message'
        client.close()
コード例 #2
0
ファイル: tcp_transport.py プロジェクト: yuna-98/Telethon
    def __init__(self, ip_address, port):
        self.tcp_client = TcpClient()
        self.send_counter = 0

        self.tcp_client.connect(ip_address, port)
コード例 #3
0
 def __init__(self, ip_address, port, proxy=None):
     self.ip = ip_address
     self.port = port
     self.tcp_client = TcpClient(proxy)
     self.send_counter = 0