Home Explore Blog CI



neovim

35th chunk of `runtime/doc/luvref.txt`
86b2f6c91ac668628fbfe211392d5656e2ac6360058457fc0000000100000fa4
               - `addr`: `table` or `nil`
                    - `ip`: `string`
                    - `port`: `integer`
                    - `family`: `string`
                  - `flags`: `table`
                    - `partial`: `boolean` or `nil`
                    - `mmsg_chunk`: `boolean` or `nil`

                Prepare for receiving data. If the socket has not previously
                been bound with |uv.udp_bind()| it is bound to `0.0.0.0` (the
                "all interfaces" IPv4 address) and a random port number.

                See |luv-constants| for supported address `family` output values.

                Returns: `0` or `fail`

uv.udp_recv_stop({udp})                                     *uv.udp_recv_stop()*

                > method form `udp:recv_stop()`

                Parameters:
                - `udp`: `uv_udp_t userdata`

                Stop listening for incoming datagrams.

                Returns: `0` or `fail`

uv.udp_connect({udp}, {host}, {port})                         *uv.udp_connect()*

                > method form `udp:connect(host, port)`

                Parameters:
                - `udp`: `uv_udp_t userdata`
                - `host`: `string`
                - `port`: `integer`

                Associate the UDP handle to a remote address and port, so
                every message sent by this handle is automatically sent to
                that destination. Calling this function with a NULL addr
                disconnects the handle. Trying to call `uv.udp_connect()` on
                an already connected handle will result in an `EISCONN` error.
                Trying to disconnect a handle that is not connected will
                return an `ENOTCONN` error.

                Returns: `0` or `fail`

==============================================================================
`uv_fs_event_t` — FS Event handle              *luv-fs-event-handle* *uv_fs_event_t*

> |uv_handle_t| functions also apply.

FS Event handles allow the user to monitor a given path for changes, for
example, if the file was renamed or there was a generic change in it. This
handle uses the best backend for the job on each platform.

uv.new_fs_event()                                            *uv.new_fs_event()*

                Creates and initializes a new |uv_fs_event_t|. Returns the Lua
                userdata wrapping it.

                Returns: `uv_fs_event_t userdata` or `fail`

uv.fs_event_start({fs_event}, {path}, {flags}, {callback}) *uv.fs_event_start()*

                > method form `fs_event:start(path, flags, callback)`

                Parameters:
                - `fs_event`: `uv_fs_event_t userdata`
                - `path`: `string`
                - `flags`: `table`
                  - `watch_entry`: `boolean` or `nil` (default: `false`)
                  - `stat`: `boolean` or `nil` (default: `false`)
                  - `recursive`: `boolean` or `nil` (default: `false`)
                - `callback`: `callable`
                  - `err`: `nil` or `string`
                  - `filename`: `string`
                  - `events`: `table`
                    - `change`: `boolean` or `nil`
                    - `rename`: `boolean` or `nil`

                Start the handle with the given callback, which will watch the
                specified path for changes.

                Returns: `0` or `fail`

uv.fs_event_stop()                                          *uv.fs_event_stop()*

                > method form `fs_event:stop()`

                Stop the handle, the callback will no longer be called.

                Returns: `0` or `fail`

uv.fs_event_getpath()                                    *uv.fs_event_getpath()*

                > method form `fs_event:getpath()`

                Get the path being monitored by the handle.

                Returns: `string` or `fail`

==============================================================================
`uv_fs_poll_t` — FS Poll handle       

Title: Libuv UDP and FS Event Functions: Connecting, Monitoring File System Events
Summary
This section details functions for connecting a UDP handle to a remote address using `uv.udp_connect()`. It also introduces FS Event handles (`uv_fs_event_t`) for monitoring file system changes. The functions `uv.new_fs_event()`, `uv.fs_event_start()`, `uv.fs_event_stop()`, and `uv.fs_event_getpath()` are described, explaining how to create, start, stop, and retrieve the path being monitored by an FS Event handle, respectively.