Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to check / test if connection is established? #139

Open
alercelik opened this issue Jun 6, 2022 · 1 comment
Open

A way to check / test if connection is established? #139

alercelik opened this issue Jun 6, 2022 · 1 comment

Comments

@alercelik
Copy link

alercelik commented Jun 6, 2022

Hello,

Is there a way to check if connection is established succesfully with the graylog server? I could not see any. Currently i give random ports to constructor and not get any errors thus I have no way to find out whether connection is established. It would be really helpful if there is a parameter or a method to indicate that.

@BeeStingBob
Copy link

I'm using this snippet

  def check_connection(self):
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        result = sock.connect_ex((self.host, self.port))
        sock.close()
        if result == 0:
            return True
        return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants