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 delay occurs when program terminates using IOClient #32

Closed
sh4869 opened this issue Sep 14, 2015 · 2 comments
Closed

A delay occurs when program terminates using IOClient #32

sh4869 opened this issue Sep 14, 2015 · 2 comments

Comments

@sh4869
Copy link

sh4869 commented Sep 14, 2015

I tried to run these codes.

This program don't uses IOClient.

import 'package:http/http.dart' as http;

main() {
  http.get("https://www.dartlang.org").then((response) {
        print(response.body);
  });
}
<!doctype html>
~
</html>
[Finished in 2.3s]

This program uses IOClient.

import 'package:http/http.dart' as http;

main() {
  http.IOClient ioClient = new http.IOClient();
  ioClient.get("https://www.dartlang.org").then((response) {
    print(response.body);
  });
}
<!doctype html>
~
</html>
[Finished in 16.6s]

What to do to solve this problem?

@nex3
Copy link
Member

nex3 commented Sep 14, 2015

You need to call close() on the client once you're done using it. Otherwise, it will keep the program alive until its connection times out.

@nex3 nex3 closed this as completed Sep 14, 2015
@sh4869
Copy link
Author

sh4869 commented Sep 14, 2015

I see. Thanks!

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