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

ascii data not being sent via write method #118

Closed mehtapcelik284 closed 2 years ago

mehtapcelik284 commented 2 years ago

Description

ascii data not being sent via write method.

My code:

    const client = TcpSocket.createConnection(options, () => {
        client.write([56, 48, 48, 53, 48, 53], 'ascii', (error) => console.log('error', error));

        client.destroy();
    });
    client.on('data', function (data) {
        console.log('message was received', JSON.stringify(data));
    });
    client.on('error', function (error) {
        console.log(error);
    });
    client.on('close', function () {
        console.log('Connection closed!');
    });

Current behavior

error on console.log is coming null and then Connection closed!

Expected behavior

ascii data must be sent and then message was received and received data logs must be come.

Screenshot

Screen Shot 2021-08-06 at 11 45 43

Relevant information

OS: android react-native: 0.64.2 react-native-tcp-socket: ^5.2.1

Rapsssito commented 2 years ago

@Antakarana, I am sorry for your issue. Have you tested your code using Node's net API?

mehtapcelik284 commented 2 years ago

I am sorry too, there is no any error about this. The ascii data should have been sent with \n for our server. Thank you.