-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Connection error never emitted on iOS #53
Comments
@mi-mazouz, thanks for the feedback! Currently, there is not official timeout support. I am working on it. There is JS code that acts as a timeout listener/event, but it is not fully tested and might not work in all circumstances. In the meantime, this is a possible workaround: function connect(options) {
return new Promise((resolve, reject) => {
const tcpTimeout = setTimeout(() => {
reject('Timeout');
}, 1000);
const tcpSocket = net.createConnection(options, () => {
clearTimeout(tcpTimeout);
resolve();
}
);
});
} |
ok for the timeout but what about the connection error? What should happen if the connection fails? |
@mi-mazouz, if you are setting an "incorrect" IP, you should get an |
That's what I expected but I don't get this error |
@mi-mazouz, can you reproduce the bug using the example code? |
@Rapsssito Yes you should be able to reproduce it using my code |
@mi-mazouz, I meant if you could reproduce the issue using the example code provided in the repository. You can comment out all the server references and test the client with your "incorrect" IP. |
same with this code, nothing happened:
anyway, the setTimeout does the job! |
@mi-mazouz, glad it works with I will be releasing a |
same when I change the ip and I don't have any device on 192.168.1.1 |
@mi-mazouz, what device are you using? |
what do you mean? We use our own device but it does not change anything because the problem persists even if my device is off. |
@mi-mazouz, I mean what device are you using to test the app: iPhone, Huawei, Pixel... |
I'm testing with ios simulator |
@mi-mazouz, I am able to reproduce the bug on iOS. Working on it. |
hey @Rapsssito, do you have any news about this issue? |
@mi-mazouz, I have not been able to figure it out yet. I have came into the conclusion that it might be related to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Rapsssito I'm facing similar issue, but not in all the devices only iOS 14 with iphone 7,8,XR , In iPhone 11 with iOS 14 working fine. Issue is occurring at first time ,when you back and do create connection, connection created successfully. |
@itzsankar I am currently working on a fix. |
@Rapsssito Is there any update on this issue ? |
@Santhosh-kumark, yes! I found the problem, but I am really busy at the moment. The fix might take a while. |
@Santhosh-kumark @mi-mazouz, could you check if the issue still persists in the last version? I am testing on the iOS simulator without any timeout and after 1 minutes and 15 seconds I get an error in the error handler. |
@Rapsssito Have you fixed this in the latest version? |
@Rapsssito Mine was similar issue to #53 (comment) . Seems like this is not fixed in new version as well. |
@itzsankar @Santhosh-kumark, could you check if you get an error response after 2 minutes? |
I updated the package to the latest version and tested this code:
and after 1 min and 15secs the error and close events were triggered so that's a good new. |
@Rapsssito , my problem is only in iPhone version other than 11 ,iOS 14 I'm not getting any response for first time, if I quit the app and connect it again, it is connecting perfectly. But in iPhone 11 with iOS 14 it is connecting for the first time itself without any issues. |
@Rapsssito I think timeout is not working well, with the following code timeout and createConnection callback are triggered:
if createConnection callback is triggered when the connection was successful timeout should not be triggered right? |
my bad this_.device.removeListener('timeout') in createConnection callback did the job! |
@mi-mazouz, I am glad it worked! If you agree, I think we can close this issue now. It has been a difficult problem to tackle. @itzsankar, this issue has +30 comments right now. Could you please create a new issue with your problem, the devices with issues and a reproducible code? |
@Rapsssito sure, I have created a new issue #106 we can track from there , let me know if you need any details |
Description
Hello!!
I'm trying to create a tcp connection to an incorrect host (the ip is unreachable).
Here is my code:
Current behavior
this function never rejects or resolves.
Expected behavior
I expected to catch a connection error in the error event listener.
Relevant information
| react-native | 0.61.5 |
| react-native-tcp-socket | 3.7.1 |
The text was updated successfully, but these errors were encountered: