Frediano, Thank you for the unix-socket patch for x11spice! I have tried it and it works perfectly. (I did not encounter any problems/issues).
Incidentally, I stumbled upon a similar unix-socket patch for xspice. Search for "patch xserver-xspice" in the following gist, https://gist.github.com/tarruda/25bca9aa192a2a9ee690054c0b23aa08 . There is a related thread at https://discuss.linuxcontainers.org/t/tutorial-how-to-run-a-full-desktop-environment-on-lxd/14644 . I have tried the xspice patch and it also works perfectly.
On 2022-08-01, freddy77@xxxxxxxxx wrote:
Hi, did you manage to test this? Issues? Regards, Frediano Il giorno lun 18 lug 2022 alle ore 09:40 Frediano Ziglio ha scritto: > > Il giorno lun 18 lug 2022 alle ore 09:06 Frediano Ziglio
> ha scritto: > > > > Il giorno lun 18 lug 2022 alle ore 08:56 bob cantor > > ha scritto: > > > > > > Is it possible to connect to xspice via a unix-socket
rather than a tcp-port? (I would like to connect to xspice running in a LXC comtainer. The container and host are on the same machine, but there is no network connection between them). > >
> > > > > Hi, > > currently only TCP is supported but the change should not be that difficult. > > > > Hi, > something like this should do (not tested): >
> diff --git a/src/listen.c b/src/listen.c > index d00358d..292b20a 100644 > --- a/src/listen.c > +++ b/src/listen.c > @@ -39,12 +39,15 @@ > #include > #include > >
+#include > + > #include "listen.h" > #include "x11spice.h" > > #define SPICE_URI_PREFIX "spice://" > +#define SPICE_UNIX_URI_PREFIX "spice+unix://" > > -int
listen_parse(const char *listen_spec, char **addr, int > *port_start, int *port_end) > +int listen_parse(const char *listen_spec, char **addr, int > *port_start, int *port_end, int
*flags) > { > int leading = 0; > int trailing = 0; > @@ -54,6 +57,15 @@ int listen_parse(const char *listen_spec, char > **addr, int *port_start, int *por > > *port_start =
*port_end = -1; > *addr = NULL; > + *flags = 0; > + > + if (strncmp(listen_spec, SPICE_UNIX_URI_PREFIX, > strlen(SPICE_UNIX_URI_PREFIX)) == 0) { > + listen_spec +=
strlen(SPICE_UNIX_URI_PREFIX); > + > + *flags = SPICE_ADDR_FLAG_UNIX_ONLY; > + *addr = strdup(listen_spec); > + return 0; > + } > > /* Allow form of spice:// */ > if
(strlen(listen_spec) > strlen(SPICE_URI_PREFIX)) > diff --git a/src/listen.h b/src/listen.h > index 78f8792..86d5594 100644 > --- a/src/listen.h > +++ b/src/listen.h > @@ -25,7
+25,7 @@ > /*---------------------------------------------------------------------------- > ** Prototypes > **--------------------------------------------------------------------------*/
> -int listen_parse(const char *listen_spec, char **addr, int > *port_start, int *port_end); > +int listen_parse(const char *listen_spec, char **addr, int > *port_start, int
*port_end, int *flags); > int listen_find_open_port(const char *addr, int start, int end, int *port); > > #endif > diff --git a/src/spice.c b/src/spice.c > index 0c6c610..fe5be17
100644 > --- a/src/spice.c > +++ b/src/spice.c > @@ -582,9 +582,10 @@ static int try_listen(spice_t *s, options_t *options) > char *addr = NULL; > int start; > int rc; > +
int flags; > > > - rc = listen_parse(options->listen, &addr, &start, &port); > + rc = listen_parse(options->listen, &addr, &start, &port, &flags);
> if (rc) > return rc; > > @@ -599,7 +600,7 @@ static int try_listen(spice_t *s, options_t *options) > } > > if (addr) { > - spice_server_set_addr(s->server, addr, 0);
> + spice_server_set_addr(s->server, addr, flags); > free(addr); > } > > Frediano
------------------------------------------
This mail was sent by Confidesk secure mail service. Check it on https://www.confidesk.com