lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm looking at the lua socket implementation (2.0 alpha) from 

  http://www.tecgraf.puc-rio.br/~diego/luasocket/

I realize the examples/ code is unsupported by Diego (so the README in
examples/ says) so I wonder if anyone on the list has the echosrvr.lua
example working.  It goes like this for me...

  sge:72$ lua -lsocket echosrvr.lua 127.0.0.1 8933                           
  Binding to host '127.0.0.1' and port 8933...
  lua: echosrvr.lua:16: calling `setsockname' on bad self (udp{master} expected)
  stack traceback:
          [C]: in function `setsockname'
          echosrvr.lua:16: in main chunk
          [C]: ?
  sge:73$

After argument processing the script gets into trouble executing the
3rd line of the 4 below...

  udp, err = socket.udp()
  if not udp then print(err) os.exit() end
  err = udp:setsockname(host, port)
  if err then print(err) os.exit() end

If this isn't the right way to bind a udp socket to a host and port,
would someone please tell me what is?

Thanks,
Steve