Left here for archival purposes.

User avatar
By M0ebius
#6691 In the following example, it seems that the connection event is not working (using NodeMCU 0.9.5 build 20150108)
At least i never get the "connect" message...
Code: Select alls=net.createServer(net.TCP)
s:listen(8007,function(c)
c:on("receive",function(c,l)
  uart.write(0,l)
  end)
c:on("connection",function(c)   
  print("connect")
  end)
c:on("disconnection",function(c)
  print("disconnect")
  end)
end)

did i do something wrong, or is this behavior unintentional?
User avatar
By ThomasW
#6695
M0ebius wrote:In the following example, it seems that the connection event is not working (using NodeMCU 0.9.5 build 20150108)
At least i never get the "connect" message...
Code: Select alls=net.createServer(net.TCP)
s:listen(8007,function(c)
c:on("receive",function(c,l)
  uart.write(0,l)
  end)
c:on("connection",function(c)   
  print("connect")
  end)
c:on("disconnection",function(c)
  print("disconnect")
  end)
end)

did i do something wrong, or is this behavior unintentional?


The callback in s:listen() gets the "connection"-event:

Code: Select alls=net.createServer(net.TCP)
s:listen(8007,function(c)
c:on("receive",function(c,l)
  uart.write(0,l)
  end)
c:on("disconnection",function(c)
  print("disconnect")
  end)
-- Handle the initial connection:
 print("connect")
end)


Thomas