mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Improve net-to-serial proxy
This commit is contained in:
@@ -6,14 +6,12 @@ from driver.models import DriverConfiguration
|
||||
class Connector:
|
||||
|
||||
def __init__(self):
|
||||
config = DriverConfiguration.get_solo()
|
||||
self.remote_host = config.remote_host
|
||||
self.remote_port = config.remote_port
|
||||
self.config = DriverConfiguration.get_solo()
|
||||
|
||||
def __send_data(self, message):
|
||||
# to be encoded
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
sock.connect((self.remote_host, self.remote_port))
|
||||
sock.connect((self.config.remote_host, self.config.remote_port))
|
||||
sock.sendall(message)
|
||||
resp = sock.recv(1024)
|
||||
|
||||
|
Reference in New Issue
Block a user