Giter Club home page Giter Club logo

Comments (5)

PatrickDahlin avatar PatrickDahlin commented on June 3, 2024

If you take a look at line 268 in that same file, it'll emit an 'error' event since the parameter "exception" will be truthy.

Besides, regardless if the handle is closing, it'll call callback function from 258 or 262.

Minimal sample code for a repro always helps more than just pointing at a line and say error.

from luvit.

d4rkmen avatar d4rkmen commented on June 3, 2024

Here we go the tcp-echo-client-simple.lua slightly changed:

local net = require('net')

local client
client = net.createConnection(12345, '127.0.0.1', function (err)

  if err then error(err) end

  print("Connected...")

  -- Send stdin to the server
  process.stdin:on("data",function(data) -- or 'process.stdin:pipe(client)'
    client:write(data)
  end)

  -- Send the server's response to stdout
  client:on("data",function(data) -- or 'client:pipe(process.stdout)'
    process.stdout:write(data)
  end)

  -- Error handler
  client:on("error",function(err)
    print("error: " .. err)
    client:close()
  end)
  
end)

No error message in case the target name not resolved or the port is not connected
Actually, there will be only client read errors being handled

from luvit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.