PeelTechnologies / react-native-tcp

node's net api in react-native
MIT License
284 stars 212 forks source link

Attempt to invoke virtual method 'java.io.OutputStream' java.net.Socket.getOutputStream on a null object reference. #117

Open sergeushenecz opened 2 years ago

sergeushenecz commented 2 years ago

Description

I have print btn.

When I click for the first time everything is fine. Sometimes I click a second time and it's also good, but there is such a random error

Steps to reproduce

Steps to reproduce the behavior:

const client = TcpSocket.createConnection({
            host: printer.ip,
            port: printer.port,
          }, () => {
            client.write(data);
            client.destroy();
          });

          client.on('error', (error) => {
          });

          client.on('close', () => {
          });
  });

Current behavior

Attempt to invoke virtual method 'java.io.OutputStream' java.net.Socket.getOutputStream on a null object reference.

Expected behavior

Code to need works.

Screenshots

2022-03-27 22 51 54

Relevant information

OS android
react-native 0.64.3
react-native-tcp-socket 5.6.0
gajjartejas commented 1 month ago

You can use my fork at https://github.com/gajjartejas/react-native-tcp