Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
304 stars 80 forks source link

[iOS] server.close() callback never fires #144

Closed rkeiii closed 1 year ago

rkeiii commented 2 years ago

Description

When providing a callback function to server.close() it works as expected on Android but on iOS (iOS Simulator iPhone 13 iOS 15.2) the callback never fires. Despite this when I check the socket is successfully unbound and the server is shutdown.

Steps to reproduce

The console.debug() statement below is never executed.

server.close(() => {
        console.debug('Local server finished shuting down');
      });

Current behavior

The TCP server shutdown is successful but the server.close() callback never fires.

Expected behavior

The server.close() callback should fire on iOS just as it does on Android.

Relevant information

OS iOS 15.2
react-native 0.66.3
react-native-tcp-socket 5.6.0
Rapsssito commented 2 years ago

@rkeiii, thanks for the feedback! I will release a fix ASAP

nikos9413 commented 2 years ago

Hello, it does not work for me on Android. I'm calling server.close() and nothing happens. When I call it a second time, it crashes completely out of the app. The server instance I'm using is the correct one; I tested it with a server.getConnections() call. Test devices are OnePlus 8 and Huawei P8 Lite. One is fairly new and the other is pretty old.

`"dependencies": {

"@react-native-community/netinfo": "^8.2.0",
"react": "17.0.2",
"react-native": "0.67.4",
"react-native-tcp-socket": "^5.6.2",
"readable-stream": "3.6.0",
"stream-browserify": "3.0.0"

}, "devDependencies": {

"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.66.15",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"babel-jest": "^26.6.3",
"eslint": "^7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2",
"rn-nodeify": "^10.3.0",
"typescript": "^4.4.4"

},`

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 6.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: