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

I can't ping servers that have a port other than 25565 #10

Open
KamilPaciorek opened this issue Jun 28, 2023 · 6 comments
Open

I can't ping servers that have a port other than 25565 #10

KamilPaciorek opened this issue Jun 28, 2023 · 6 comments

Comments

@KamilPaciorek
Copy link

KamilPaciorek commented Jun 28, 2023

Hello, I noticed that only the server with port 25565 is displayed. If the server has a different port, it is not displayed.

below my code:

https://pastebin.com/Ne5igc2m

@spnda
Copy link
Owner

spnda commented Jun 28, 2023

You're using the function incorrectly. The ping function takes the port as a separate parameter:

Future<ResponsePacket?> ping(String serverUri,
{int port = 25565, Duration timeout = const Duration(seconds: 30)}) async {

@KamilPaciorek
Copy link
Author

are you able to help me how to get this feature to work properly? because some servers actually only display, but most are not displayed.

@spnda
Copy link
Owner

spnda commented Jun 28, 2023

I'm not sure what you're asking exactly. I have told you exactly how to use the ping function, which as far as I know works in all cases. Without any more debug information from your side about which servers are not showing up, if its because of the port, or other information that might be relevant, I can't do much. So, please give me more information or I simply can't help you.

@KamilPaciorek
Copy link
Author

When I run this function, I get an error saying 'ServerStatus' not found

Building with Flutter multidex support enabled.
lib/screens/server_list_screen.dart:40:10: Error: Type 'ServerStatus' not found.
Future ping(String address) async {
^^^^^^^^^^^^
lib/screens/server_list_screen.dart:171:8: Error: Type 'ServerStatus' not found.
Future pingServer(String address) async {
^^^^^^^^^^^^
lib/screens/server_list_screen.dart:127:40: Error: 'ServerStatus' isn't a type.
return FutureBuilder(
^^^^^^^^^^^^
Target kernel_snapshot failed: Exception

this is my full code:

https://pastebin.com/hSvss4PP

@spnda
Copy link
Owner

spnda commented Jun 29, 2023

ServerStatus is not a type and I'm not sure where you got that from. The ping function from the library returns a ResponsePacket? in a Future.

You still haven't fixed the actual issue you had with the fix I told you, by passing the int as a separate parameter to the ping function. That should be the first thing to do.

All of the questions so far have been normal Dart questions that seem to arise because of unfamiliarity with the language, so I'd recommend asking on a dedicated Dart help forum about these questions.

@KamilPaciorek
Copy link
Author

can you add support for bedrock edition servers?

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