Use an executable example for net.socket:on()

This commit is contained in:
Marcel Stör 2017-01-01 14:15:37 +01:00
parent f8f1069225
commit 61f4e18301
1 changed files with 3 additions and 3 deletions

View File

@ -310,11 +310,11 @@ Otherwise, all connection errors (with normal close) passed to disconnection eve
```lua ```lua
srv = net.createConnection(net.TCP, 0) srv = net.createConnection(net.TCP, 0)
srv:on("receive", function(sck, c) print(c) end) srv:on("receive", function(sck, c) print(c) end)
srv:on("connection", function(sck) srv:on("connection", function(sck, c)
-- Wait for connection before sending. -- Wait for connection before sending.
sck:send("GET / HTTP/1.1\r\nHost: 192.168.0.66\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") sck:send("GET /get HTTP/1.1\r\nHost: httpbin.org\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
end) end)
srv:connect(80,"192.168.0.66") srv:connect(80,"httpbin.org")
``` ```
#### See also #### See also