[Libwebsockets] Windows integration with external sockets

Andy Green andy at warmcat.com
Sun Mar 27 21:09:59 CEST 2016



On March 27, 2016 11:25:56 PM GMT+08:00, "Martin Labonté" <martin.labonte at sympatico.ca> wrote:
>Hello,
>
>I want to build a prototype with libwebsockets under Windows that
>listen on 
>2 external sockets. I looked the external loop sample but it's broken
>so I 
>tried the libuv support. I get a compilation error saying that
>io_watcher is 
>not a member of uv_poll_t. Should I rewrite the libuv.c to use the
>latest 
>libuv or there is an older version of libuv that will be ok for 
>libwebsockets under Windows?
>
>I guess another option would be to rewrite lws-plat-win.c to add my two
>
>sockets file descriptors directly but that option would be acceptable
>only 
>for the prototype. I'm open to all suggestions.

I have been working on adding proper vhost support the last few days, and this seems to work well.  You can register as many vhosts as you like to the context, each may create a new listen socket, or if the interface + port already has a listen socket it will just make itself available there as a logical vhost.  For ssl, each vhost may have his own keys, and SNI is supported to select the vhost at ssl layer.

I also have the start of a generic webserver using this stuff.  It should be enough working to push on master tomorrow.  It's only tested on Linux with poll() event loop, but the changes did not involve the event loop.  And the vhost changes are transparent to user code, you must give an _OPTION_ flag at context creation time to tell it you will provide vhosts by a new api, otherwise the default is the traditional 'register one vhost at context creation time'.  The new 'lwsws' webserver introduced at the same time will show how to do it.

-Andy

>Thanks,
>
>Martin
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list