From sylvain.saunier at gmail.com Wed Jan 12 16:28:26 2022 From: sylvain.saunier at gmail.com (Sylvain Saunier) Date: Wed, 12 Jan 2022 16:28:26 +0100 Subject: [Libwebsockets] how to set client socket local port Message-ID: Hi Andy, first, i wish you an happy new year second, sorry for my english in advance... so, i would like to set the binding "local port" for a client connection when i use lws_client_connect_via_info(). i know i have possibility to set the local IP with iface (in lws_client_connect_info) there is also information port but it is for the "remote port" should be possible to add a new info to set the "local port" instead default 0 set in function lws_client_connect_3_connect when calling lws_socket_bind. ? or may be you have another way to do that ? thank you for your help sylvain -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at warmcat.com Wed Jan 12 16:38:56 2022 From: andy at warmcat.com (Andy Green) Date: Wed, 12 Jan 2022 15:38:56 +0000 Subject: [Libwebsockets] how to set client socket local port In-Reply-To: References: Message-ID: On 1/12/22 15:28, Sylvain Saunier wrote: > Hi Andy, > > first, i wish you an happy new year > second, sorry for my english in advance... > > so, i would like to set the binding "local port" for a client connection > when i use lws_client_connect_via_info(). > i know i have possibility to set the local IP with iface (in > lws_client_connect_info) > there is also information port but it is for the "remote port" > should be possible to add a new info to set the "local port" instead > default 0? set in function > lws_client_connect_3_connect when calling lws_socket_bind. ? Yes I think you'd have to add a uint16_t member for it in the client connection info struct... zero would mean pick an ephemeral port as now. You'd have to add stuff as you say in client_connect_3 to make that happen. Patch is welcome... -Andy