[Libwebsockets] How to get socket id from incoming request ?

Remi de Gravelaine gravelaine at gmail.com
Tue Jun 21 13:57:14 CEST 2016

And also, as said in my previous answer (with a wrong title, sorry for 

IMNSHO, there is a big flaw in this code.
wsi is already the unique pointer you need and &wsi is not what you
want, as it is another pointer probably always located at the same place
in the stack.

Try again.

Le 13/06/2016 ? 05:39, libwebsockets-request at ml.libwebsockets.org a ?crit :
 > On June 12, 2016 5:29:16 PM GMT+08:00, Meir Yanovich<meiry242 at gmail.com>
 >> wrote:
 >>>> I try this as Andy suggested all of this in the server . under the 
 >>>> long wsi_adress = &wsi;
 >>>> lwsl_notice("string recived from client:%lu\n", wsi_adress);
 >>>> i tried to invoke several ws requests  from different browsers
 >>>> but it always gave me the same value . am i do it currently of you
 >>>> meant to
 >>>> something totally different ?
> Message: 1
> Date: Tue, 21 Jun 2016 05:26:35 +0000
> From: Suman.Patro-TRN <Suman.Patro-TRN at lntebg.com>
> To: "libwebsockets at ml.libwebsockets.org"
> 	<libwebsockets at ml.libwebsockets.org>
> Subject: [Libwebsockets]  How to get socket id from incoming request ?
> Message-ID:
> 	<1244052bc6df4a1a8e2add3abefc6708 at POCITMSXMB02.LntUniverse.com>
> Content-Type: text/plain; charset="us-ascii"
> Hello Meir,
> To get wsi pointer of each client connection request , you could return context->pt->fds->fd from a method that returns a SOCKET id .My answer is completely windows-specific and have no idea about socket.io. But if your requirement is to get socket ids of each web client connection requests and map those at the server end for using those socket ids to send reply messages to the connected clients, this method should work. Mine works properly.The solution is for libwebsockets master version.
> Thanks and regards,
> Suman
> Larsen & Toubro Limited
> www.larsentoubro.com
> This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20160621/7779b088/attachment-0001.html>

More information about the Libwebsockets mailing list