Skip to content

Network Support #2

@robbrad

Description

@robbrad

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions