:: Re: [DNG] Unix Socket class: how to…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: aitor_czr
Fecha:  
A: dng
Asunto: Re: [DNG] Unix Socket class: how to send arguments to the suid of simple-netaid
Hi,

On 12/9/19 6:49, aitor_czr wrote:
> Maybe you are wondering about the reaseon why the server of the socket
> should be multithreaded.
> Well... Download the following example:
>
> http://gnuinos.org/socket/ip/
>
> The code of the server has been replaced by:
>
> serverSocket( { FILE_DESCRIPTOR, "0", "wlan0" } );
> system("sudo ./client");
>
> That is, the information is sent through the file descriptor and
> immediatly after the client is run *while*
> the server is waiting to be heard in a separate thread.
>
> Just run:
>
> $ ./server
>
> and your network interface (wlan0) will be brung down.
>
> Cheers,
>
> Aitor.
>

There were some minor error in the example. For example, the name of the
object in the constructor of the server was missing:

serverSocket sender( { FILE_DESCRIPTOR, "0", "wlan0" } );

I fixed them, and now it works:

http://gnuinos.org/socket/ip/

Cheers,

Aitor.