lua-users home
lua-l archive

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

While we are on the topic of random feature requests...
one thing would personally find quiet useful for LuaSocket
to provide is standard io library compatibility layer...
if such package existed, one could swap it
seamlessly with the standard file based io library and
pretty much turn any regular Lua code into a network
ready application...

Non-trivial to do portably. Sockets are not files. Socket fds and file fds can mostly be interchanged under UNIX/Linux, but not on all OSes, notably Windows and Windows-derived OSes (e.g. WinCE). Under Windows, file I/O and socket I/O are just, well, different...

Of course, you can wrap Windows to look and behave in a Linux/UNIXy fashion, but not in any compact, simple or secure fashion (Cygwin, QED.)

This is why an astonishingly useful tool like socat:

isn't easy at all to port to Windows -- the only known Windows version requires Cygwin, which isn't a port in any reasonable sense. (And look at home much extra code is needed in netcat to make the "-l -e" option work under Windows, compared to under Unix, though this also comes down to the lack of fork() under Windows.)

KISS says to have a core file I/O library, and an "add-on" socket I/O library, IMO.