Im using react-native-tcp-socket and my code is identical to what is in their docs. I am able to make a connection and send/receive one message, but when I try to connect again, I get this error. I am working on an android simulator and connecting to a node js server.
var client = TcpSocket.createConnection(options);
client.on('data', function(data) {
console.log('message was received', data);
});
client.on('error', function(error) {
console.log(error);
});
client.on('close', function(){
console.log('Connection closed!');
});
// Write on the socket
client.write('COORDINATE_MOVE ELEV:' + this.state.elevation + 'AZIM:' + this.state.azimuth + 'ID:todd');
// Close socket
client.destroy();