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

Handle connection refused error #89

Closed
Fedour57 opened this issue Dec 11, 2020 · 1 comment
Closed

Handle connection refused error #89

Fedour57 opened this issue Dec 11, 2020 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request is duplicated

Comments

@Fedour57
Copy link

Description

Hello, I'm trying to handle a connection refused error, if I try to connect to a server that doesn't exist, my app crash.

Steps to reproduce

Code:

try
{
    var client = net.createConnection({ port: 49500, host: "255.0.0.0",timeout:1000 })
}
catch (error)
{
    console.log(error)
}

OR

 var client = net.createConnection({ port: 49500, host: "255.0.0.0",timeout:1000 })
 .then(val =>
{
    console.log("connected")
}           
).catch(error => {
    console.log(error)
})

Current behavior

The app crash when the client can not connect to the server.

Expected behavior

The try catch block should handle the error

Relevant information

react-native 0.63.3
react-native-tcp-socket 4.5.4
@Fedour57 Fedour57 added the bug Something isn't working label Dec 11, 2020
@Rapsssito
Copy link
Owner

@Fedour57, thanks for your feedback! Please, take a look at #53, it might be your problem. You could try some of the workarounds commented over there.

@Rapsssito Rapsssito added the duplicate This issue or pull request is duplicated label Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request is duplicated
Projects
None yet
Development

No branches or pull requests

2 participants