mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
1dac866118
The initial release contains the most basic implementation of TLSharp core. This is also fully untested, since no test can be done until more work is done.
21 lines
416 B
Python
21 lines
416 B
Python
import socket
|
|
|
|
|
|
class TcpClient:
|
|
|
|
def __init__(self):
|
|
self.connected = False
|
|
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
def connect(self, ip, port):
|
|
self.socket.connect((ip, port))
|
|
|
|
def close(self):
|
|
self.socket.close()
|
|
|
|
def write(self, data):
|
|
self.socket.send(data)
|
|
|
|
def read(self, buffer_size):
|
|
self.socket.recv(buffer_size)
|