Telethon/network/tcp_client.py
Lonami 1dac866118 Initial release
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.
2016-08-26 12:58:53 +02:00

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)