influxdata / influxdb-client-dart

InfluxDB (v2+) Client Library for Dart and Flutter
MIT License
25 stars 10 forks source link

Connection problem - Socket Exception #32

Closed barilki closed 2 years ago

barilki commented 2 years ago

Hi, I trying to connect to Influx but unfortunately I'm getting an error: I/flutter ( 2913): >> GET http://localhost:8086/ping ===== I/flutter ( 2913): >> headers: {Authorization: Token UR5_tNrPq5fAjuL6TfX_G7KQEozzvZWT35a7xbVbojoqRwba38tU6lhWEMPoJasvMmaf9D2g793mfbBCZVzLsQ==, User-Agent: influxdb-client-dart/2.1.0} I/flutter ( 2913): >> contentLength: 0 E/flutter ( 2913): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 42422 E/flutter ( 2913): #0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:681:35) E/flutter ( 2913): #1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1808:26) E/flutter ( 2913): #2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23) E/flutter ( 2913): #3 Socket._startConnect (dart:io-patch/socket_patch.dart:2027:22) E/flutter ( 2913): #4 Socket.startConnect (dart:io/socket.dart:784:21) E/flutter ( 2913): #5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2439:18) E/flutter ( 2913): #6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2808:12) E/flutter ( 2913): #7 _HttpClient._getConnection (dart:_http/http_impl.dart:2813:12) E/flutter ( 2913): #8 _HttpClient._openUrl (dart:_http/http_impl.dart:2697:12) E/flutter ( 2913): #9 _HttpClient.openUrl (dart:_http/http_impl.dart:2569:7) E/flutter ( 2913): #10 IOClient.send (package:http/src/io_client.dart:35:38) E/flutter ( 2913): #11 LoggingClient.send (package:influxdb_client/client/influxdb_client.dart:316:25) E/flutter ( 2913): #12 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:38) E/flutter ( 2913): #13 BaseClient.get (package:http/src/base_client.dart:27:7) E/flutter ( 2913): #14 ApiClient.invokeAPI (package:influxdb_client/api_client.dart:152:32) E/flutter ( 2913): E/flutter ( 2913): #15 PingApi.getPing (package:influxdb_client/api/ping_api.dart:50:22) E/flutter ( 2913): E/flutter ( 2913): #16 main (package:influxdb_app/main.dart:17:3) E/flutter ( 2913):

bednar commented 2 years ago

Hi @barilki,

thanks for using our client.

It looks like that your InfluxDB doesn't listen on your localhost. Try to use IP address as an url of your InfluxDB.

Regards

bednar commented 2 years ago

This issue has been closed because it has not had recent activity. Please reopen if this issue is still important to you and you have additionally information.