On Tue, Feb 09, 2016 at 01:57:32AM +0100, Bram Moolenaar wrote: > > Olaf Dabrunz wrote: > > > On 08-Feb-16, Bram Moolenaar wrote: > > > Some parts that we still need that require some thougths: > > > > > > - Communicating over a socket requires knowing the port number. For a > > > deamon this would be a known number. For a server started by Vim it's > > > best to let the server pick an available port. Then how does it tell > > > Vim what port it picked? In test_channel we write the port number in > > > a file. That's not ideal, but perhaps there is no better solution. > > > Having Vim pick a free port and pass it to the server has race > > > conditions > > > (but it might still be an acceptable solution). > > > > To avoid the race, Vim could open the server's listening socket before > > forking off the server, then close the socket descriptor on Vim's side. > > I don't think that works. If Vim keeps the socket open the server can't > open it again, gives an "already in use" error.
The whole point is that Vim doesn't keep it open. Vim opens the socket and sets it up so the server that gets spawned inherits the descriptor. The server can then just use the inherited descriptor and Vim closes its descriptor. Cheers, -- James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@jamessan.com> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.