mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
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.
This commit is contained in:
20
network/tcp_client.py
Normal file
20
network/tcp_client.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
Reference in New Issue
Block a user