mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 19:16:43 +00:00

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)
|