What exactly triggers creation of a new client in Wayland server

Marty Jack martyj19 at comcast.net
Tue Jan 18 13:51:57 PST 2011


You have it right.

When a client does a connect on a socket that another process is listening to (the listen is at line 692), this makes the other end get a "readable" on its end of the socket.  You then do an accept, which gives you a new fd for your end of the connection.  You then have a bidirectional path between the client's end and the compositor's end.  If you write data down one end, it is readable at the other, and vice versa.

In this case it is what is called a "UNIX domain socket", which is represented by an entry in the file system.

man 2 listen, man 2 accept, man 7 unix, any tutorial on networking

On 01/18/2011 04:15 PM, Zan Dobersek wrote:
> Greetings,
> 
> I'm wondering what exactly sets off the socket_data function in wayland/wayland-server.c at approximate line 640. I can see that we add a file descriptor object of our socket to the main loop in wl_display_add_socket that uses socket_data as the callback function when a client connects to that socket. Subsequently, we accept the connection in socket_data and create a new client.
> 
> So, what is it in client's code that causes socket_data to be called? Is it just the mere connect() call to establish a connection through that socket or is it anything more complex that I have missed?
> 
> My knowledge of sockets is quite basic, so I would be happy if someone would clarify how exactly this bit of code is executed.
> 
> Regards,
> 
> Zan Dobersek
> 
> 
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list