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

mctools usage #13

Open
OwenCochell opened this issue Jun 28, 2023 · 1 comment
Open

mctools usage #13

OwenCochell opened this issue Jun 28, 2023 · 1 comment

Comments

@OwenCochell
Copy link
Owner

          help pls

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Towa\AppData\Local\Programs\Python\Python39\lib\site-packages\mctools\mclient.py", line 709, in get_full_stats
chall = self.get_challenge().chall
File "C:\Users\Towa\AppData\Local\Programs\Python\Python39\lib\site-packages\mctools\mclient.py", line 645, in get_challenge
pack = self.raw_send(9, None, "chall")
File "C:\Users\Towa\AppData\Local\Programs\Python\Python39\lib\site-packages\mctools\mclient.py", line 625, in raw_send
self.proto.send(QUERYPacket(reqtype, self.reqid, chall, packet_type))
File "C:\Users\Towa\AppData\Local\Programs\Python\Python39\lib\site-packages\mctools\protocol.py", line 350, in send
self.write_udp(byts, self.host, self.port)
File "C:\Users\Towa\AppData\Local\Programs\Python\Python39\lib\site-packages\mctools\protocol.py", line 128, in write_udp
self.sock.sendto(byts, (host, port))
socket.gaierror: [Errno 11001] getaddrinfo failed

code:
from mctools import QUERYClient
query = QUERYClient('ip:port')
stats = query.get_full_stats()

Originally posted by @Towux in #11 (comment)

@OwenCochell
Copy link
Owner Author

Hello, thank you for commenting! I wanted to open a new issue, as it was not relevant to the old one you commented in.

Here is your code:

from mctools import QUERYClient
query = QUERYClient('ip:port')
stats = query.get_full_stats()

You are importing mctools correctly, and are doing the correct function calls. However, the IP address you are passing to the QUERYClient is incorrect. The format of the connection string is like this:

[IP]:[PORT]

Simply fill in the sections with your connection information. For example, if you are connecting to the IP address 1.2.3.4:

query = QUERYClient('1.2.3.4')

If the system you are connecting to uses the default QUERY port, then you can omit the port section of the connection string, mctools will connect to the default port automatically. Lets say you wanted to connect to 55.67.149.52 on port 567:

query = QUERYClient('55.67.149.52:567')

Using this connection string, the client will then try to connect to the addresses you gave it. You can also use domain names in the connection string as well, let's say I wanted to connect to myserver.mc on port 123:

query = QUERYClient('myserver.mc:123')

The problem you are facing is that your connection string is incorrect:

 query = QUERYClient('ip:port')

The client is trying to use ip as the IP address, and port and the port. Both of these are invalid, and you must provide a valid connection string. The error you encountered, socket.gaierror: [Errno 11001] getaddrinfo failed, means that your operating system was unable to determine the proper way to connect to the address you provided. If you use one of the methods above to construct your connection string, then things should work correctly for you.

Let me know if anything does not work as intended.

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

1 participant