You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Client on react-native-tcp-socket will send and receive data on the first request, but all further requests are denied with error "connection closed". Is there any way to re-open this connection after the first one closes?
Run server on separate machine using 'node index.js'
Download project and with android emulator open, run 'react-native run-android'
Click on 'Run script', accept, run any of the given script options (all they do is send a string to the server over TCP)
Current behavior
First request reaches the server fine. Any further requests result in an "Error: Socket is closed" or "Error: Attempt to invoke virtual method void java.net.socket.connect on a null object reference". Commenting out all 'client.destroy();' lines appears to fix the problem until a second or third connection is made, then no data is sent or received at all. Almost as if the request is timing out. ('selection made' indicates the button was pressed).
Client-side:
Server-side:
Expected behavior
Each time the button is pressed, a request should send to the server successfully. I'm very new to networking so if I'm doing something wrong, please let me know.
Screenshots
Client-side:
Server-side:
Relevant information
OS
Android v. 9 emulator
react-native
0.61.4
react-native-tcp-socket
3.5.0
The text was updated successfully, but these errors were encountered:
@amcdevitt97 your problem might be related to the line 63 in the client.
You call client.destroy() right after TcpSocket.createConnection(), which makes the client destroy itself immediately after creation. Try to remove that line and rethink your logic. If the issue still persists, reply back.
Description
Client on react-native-tcp-socket will send and receive data on the first request, but all further requests are denied with error "connection closed". Is there any way to re-open this connection after the first one closes?
Code for client (React-native-tcp-socket needs updated): https://github.com/YCPRadioTelescope/rtMobile/blob/scripts/src/components/scriptsModal/scriptsModal.js
Code for the server is this "simple tcp server": https://sodocumentation.net/node-js/topic/6545/tcp-sockets
Steps to reproduce
Steps to reproduce the behavior:
Current behavior
First request reaches the server fine. Any further requests result in an "Error: Socket is closed" or "Error: Attempt to invoke virtual method void java.net.socket.connect on a null object reference". Commenting out all 'client.destroy();' lines appears to fix the problem until a second or third connection is made, then no data is sent or received at all. Almost as if the request is timing out. ('selection made' indicates the button was pressed).
Client-side:
Server-side:
Expected behavior
Each time the button is pressed, a request should send to the server successfully. I'm very new to networking so if I'm doing something wrong, please let me know.
Screenshots
Client-side:
Server-side:
Relevant information
The text was updated successfully, but these errors were encountered: