Avatar for Norbi

Norbi

Member since Jul 2016 • Last active Aug 2016
  • 1 conversations
  • 3 comments

Most recent activity

  • started
    • 5 comments
    • 2,173 views
  • in JavaScript
    Avatar for Norbi

    Client print : "Hello World" just once, server does not print anything
    But if i will delete line 10 of server code, server once per second print: "Get"

  • in JavaScript
    Avatar for Norbi

    client was running on node js.

  • in JavaScript
    Avatar for Norbi

    Client can not get "Hello" message from server.
    What is wrong?

    server

    SPI2.setup({ mosi:B15, miso:B14, sck:B13 });
    var eth = require("WIZnet").connect(SPI2, B10);
    eth.setIP({ ip: '192.168.1.5' }); 
    console.log("IP = "+eth.getIP().ip);
    
    var server = require("net").createServer(function(socĀ­ket) {
    socket.write("Hello World");
    socket.on('data', function(data) {
    console.log(">"+JSON.stringify(data));
    socket.write("Hello");
    });
    });
    server.listen(1234);
    
    

    client

    var client = require("net").connect({host: "192.168.1.5", port: 1234}, function() {
    console.log('client connected');
    setInterval(function() {
    client.write('Get');
    }, 1000);
    client.on('data', function(data) {
    console.log(">"+data);
    });
    });
    
    
Actions