-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
This is amazing work - I found this by doing my own and though I wonder if someone else has done this before
Where im going is to do this via the network interface instead using the following
Reason is I have the mount in an observatory connected to a network
Could your lib support the same ?
def _send_command(self, command, expected_length=None):
try:
ip = socket.gethostbyname(self.mount_address)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((ip, self.port))
while True:
s.sendall(command.encode())
response = s.recv(1024).decode().strip()
# Check if expected_length is provided and response length matches
if expected_length is not None and len(response) != expected_length:
continue
else:
return response # Return response if length matches or if expected_length is not provided
except socket.error as e:
return f"Cannot connect to {self.mount_address}:{self.port}: {e}"
Metadata
Metadata
Assignees
Labels
No labels