revenge: Add ch_listen() function for socket server support#19231
revenge: Add ch_listen() function for socket server support#19231mattn wants to merge 11 commits intovim:masterfrom
Conversation
|
I'll fix test fail in later. |
|
Thanks that is nice. But I'll move this after the Vim 9.2 release. |
|
It is not clear from the docs how |
|
@chrisbra This is simple practice example working as HTTP file server. https://gist.github.com/mattn/3e691419c37fe7ce501dc37e2a1bb545 |
|
Thanks.
Why do we need |
|
I wonder if this would help @yegappan lsp to support lsp servers without |
|
Call tree is below. Should we rename channel_listen to channel_listen_tcp ? |
|
I think we should have one single |
@habamax This is already possible, see |
|
@chrisbra
The |
|
Summary
#3639
This patch adds
ch_listen()function to Vim, allowing scripts to create listening sockets and accept incoming network connections. This enables Vim to act as a simple network server for various use cases.Changes
New Functions
ch_listen(address [, options])- Listen on a socket and accept connectionschannel_listen_unix(path, callback)- Unix domain socket supportchannel_listen_func(argvars)- Vim script interfaceImplementation Details
ch_listenfield tostruct channel_Sto mark listening socketschannel_read()to handle accept() on listening socketsAPI Usage
Use Cases
Testing
Test_listen()intest_channel.vimRelated Features
This complements the existing
ch_open()function:ch_open()- connect to a serverch_listen()- accept connections as a serverLimitations
This is demonstration of HTTP server written in Vim script.