I have the following code snippet:
var options = { host:"192.168.0.113", port:8823 }; var socket = require("net").connect( options, function() { socket.on('data', function(data) { console.log("HTTP> "+data); } ); } ); socket.end( JSON.stringify( obj ) ); console.log( 'should be sent by now' );
Upon running, the server does not receive any data.
I tried also socket.write( JSON.stringify( obj ) ) and putting write/end calls inside of the callback function - neither worked.
The test code in Groovy works just fine:
Socket s = new Socket() s.connect( new InetSocketAddress( "192.168.0.113", 8823 ) ) s.outputStream.withWriter{ it << 'aaaaa' }
@Injecteer started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I have the following code snippet:
Upon running, the server does not receive any data.
I tried also socket.write( JSON.stringify( obj ) ) and putting write/end calls inside of the callback function - neither worked.
The test code in Groovy works just fine: