mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-17 14:29:46 +02:00
addee9d8fbdcd493648c36222209982109755831
socket.tcp can accept fd and socket type ('master'(default), 'client') acceptfd method can be used to write multi-threaded server. ```lua -- main thread local fd = srv_sock:acceptfd() Threads.runfile('echo.lua', fd) -- echo.lua local fd = ... local sock = socket.tcp(fd,'client') ``` or to interact with library such as [ESL](http://wiki.freeswitch.org/wiki/Event_Socket_Library) ```lua local fd = srv_sock:acceptfd() Threads.runfile('worker.lua', fd) -- worker.lua local sock = ESLconnection((...)) ``` If we need just close fd (for example we can not run worker thread) we should call `socket.tcp(fd,'client'):close()`
This is the LuaSocket 2.1. It has been tested on --[[WinXP--]], Mac OS X, and --[[Linux--]]. Please use the Lua mailing list to report any bugs (or "features") you encounter. Have fun, Diego Nehab.
Languages
HTML
48.5%
C
27.1%
Lua
22.7%
Makefile
1.5%