]> git.sesse.net Git - vlc/blobdiff - share/lua/README.txt
Add vlc.net.poll() and use in modules/host.lua.
[vlc] / share / lua / README.txt
index 4defc9b54f970b55292b1314b905bdb2522b9619..bcafa1b8b93dfc65a2e616e99efcbd64a4936e25 100644 (file)
@@ -112,8 +112,9 @@ net.url_parse( url, [option delimiter] ): Parse URL. Returns a table with
   fields "protocol", "username", "password", "host", "port", path" and
   "option".
 net.listen_tcp( host, port ): Listen to TCP connections. This returns an
-  object with an accept method. This method takes an optional timeout
-  argument (in milliseconds). For example:
+  object with an accept and an fds method. The accept takes an optional timeout
+  argument (in milliseconds). The fds method returns a list of fds you can call
+  select on before using the accept method. For example:
 local l = vlc.net.listen_tcp( "localhost", 1234 )
 while true do
   local fd = l:accept( 500 )
@@ -125,9 +126,12 @@ end
 net.close( fd ): Close file descriptor.
 net.send( fd, string, [length] ): Send data on fd.
 net.recv( fd, [max length] ): Receive data from fd.
+net.poll( { fd = events }, [timeout in seconds] ): Implement poll function.
+  Retruns the numbers of file descriptors with a non 0 revent. The function
+  modifies the input table to { fd = revents }. See "man poll".
+net.POLLIN/POLLPRI/POLLOUT/POLLRDHUP/POLLERR/POLLHUP/POLLNVAL: poll event flags
 net.select( nfds, fds_read, fds_write, timeout ): Monitor a bunch of file
-  descriptors. Returns number of fds to handle and the amount of time not
-  slept. See "man select".
+  descriptors. Returns number of fds to handle. See "man select".
 net.fd_set_new(): Create a new fd_set.
 local fds = vlc.net.fd_set_new()
 fds:clr( fd ) -- remove fd from set