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

theta-client-react-native initialize() Error: Failed to connect to InetSocketAddress(hostname=192.168.1.1, port=80). #74

Open
mirabo-trunghoang opened this issue Apr 3, 2024 · 4 comments

Comments

@mirabo-trunghoang
Copy link

mirabo-trunghoang commented Apr 3, 2024

When I call initialize(), sometimes it throws this error:

HttpClient: REQUEST http://192.168.1.1/osc/info failed with exception: kotlin.IllegalStateException: Failed to connect to InetSocketAddress(hostname=192.168.1.1, port=80).
Error: Failed to connect to InetSocketAddress(hostname=192.168.1.1, port=80).

Note that the iPhone is connected to the Theta camera Wifi already, and if I tried to call this function several times, it was successful (maybe the second time or third time,...). Almost the time, it failed when trying to connect after the first time installing the app.

The code I implemented. I use WifiManager to connect to the Theta Wifi first then call initialize()

 try {
      await WifiManager.connectToProtectedSSID(thetaSsid, password, false, false)
      await initialize();
    } catch (error) {
      console.warn(`${error}`)
    }

I know it may encounter some error when connecting but in the production, it seems not acceptable.
Please help to figure out the season why this issue happens.
Thanks.

@mirabo-trunghoang mirabo-trunghoang changed the title initialize() Error: Failed to connect to InetSocketAddress(hostname=192.168.1.1, port=80). theta-client-react-native initialize() Error: Failed to connect to InetSocketAddress(hostname=192.168.1.1, port=80). Apr 3, 2024
@simago
Copy link
Contributor

simago commented Apr 9, 2024

@mirabo-trunghoang
React Native WifiManager.connectToProtectedSSID() calls NEHotspotConfigurationManager internally.
I found NEHotspotConfigurationManager issue that may be helpful for your issue.

@mirabo-trunghoang
Copy link
Author

Hi @simago
It seems the connection is not completely established after calling WifiManager.connectToProtectedSSID(), then Theta function initialize() would not have enough data to perform initialization, right?
Do you have any suggestions for us to handle this situation? How does the Theta mobile app (the official app) handle this?
Thanks for supporting.

@simago
Copy link
Contributor

simago commented May 22, 2024

@mirabo-trunghoang
I think there is a delay between the completion of WifiManager.connectToProtectedSSID() and the completion of WiFi connection.
I could not find Theta application using WifiManager.connectToProtectedSSID() .

@mirabo-trunghoang
Copy link
Author

mirabo-trunghoang commented May 23, 2024

@simago
Yes, I'm just curious about how the Theta mobile app handles the connection. Regarding the connection not being fully established after calling the WifiManager function, I'm thinking of solving it by adding a delay (3 seconds) before calling the Theta initialization function, but it's also not guaranteed to work 100%.

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