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

http.get : SocketException #264

Closed
taojigu opened this issue Apr 9, 2019 · 4 comments
Closed

http.get : SocketException #264

taojigu opened this issue Apr 9, 2019 · 4 comments

Comments

@taojigu
Copy link

taojigu commented Apr 9, 2019

The Code is:

void _requestArticleIDList () async {
var url = 'https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty';
var response = await http.get(url);
if (response.statusCode != 200 ) {
return;
}
}

The Result I Get

E/flutter ( 5470): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: SocketException: OS Error: No route to host, errno = 113, address = hacker-news.firebaseio.com, port = 46698
E/flutter ( 5470): #0 IOClient.send
package:http/src/io_client.dart:33
E/flutter ( 5470):
E/flutter ( 5470): #1 BaseClient._sendUnstreamed
package:http/src/base_client.dart:169
E/flutter ( 5470):
E/flutter ( 5470): #2 BaseClient.get
package:http/src/base_client.dart:32
E/flutter ( 5470): #3 get.
package:http/http.dart:46
E/flutter ( 5470): #4 _withClient
package:http/http.dart:166

@natebosch
Copy link
Member

It's giving you an OS error - "No route to host". Looks like a problem with the environment - what do you think needs to happen in this package?

@taojigu
Copy link
Author

taojigu commented Apr 11, 2019

The exception only is thrown when access 'https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty' . When accessing other urls, it works fine.

@natebosch
Copy link
Member

Can you access that url otherwise on your device?

Does it work if you use https://api.dartlang.org/stable/2.2.0/dart-io/HttpClient-class.html directly?

@taojigu
Copy link
Author

taojigu commented Apr 12, 2019

my fault, found reason: hacker-news.filrebase.io.com is blocked by china government.

@taojigu taojigu closed this as completed Apr 12, 2019
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