mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
MtProtoPlainSender was not connecting (closes #62)
This commit is contained in:
parent
fbe65c2dfb
commit
6069188b54
|
@ -12,6 +12,7 @@ class MtProtoPlainSender:
|
||||||
self._time_offset = 0
|
self._time_offset = 0
|
||||||
self._last_msg_id = 0
|
self._last_msg_id = 0
|
||||||
self._transport = transport
|
self._transport = transport
|
||||||
|
self._transport.connect()
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
"""Sends a plain packet (auth_key_id = 0) containing the given message body (data)"""
|
"""Sends a plain packet (auth_key_id = 0) containing the given message body (data)"""
|
||||||
|
|
|
@ -31,11 +31,13 @@ class TcpClient:
|
||||||
|
|
||||||
def connect(self, ip, port):
|
def connect(self, ip, port):
|
||||||
"""Connects to the specified IP and port number"""
|
"""Connects to the specified IP and port number"""
|
||||||
|
if not self.connected:
|
||||||
self.socket.connect((ip, port))
|
self.socket.connect((ip, port))
|
||||||
self.connected = True
|
self.connected = True
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Closes the connection"""
|
"""Closes the connection"""
|
||||||
|
if self.connected:
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
self.connected = False
|
self.connected = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user