Unix domain socket source code

Marty Jack martyj19 at comcast.net
Wed Mar 16 13:26:59 PDT 2011



On 03/16/2011 04:03 PM, derleader mail wrote:
>  Hi,
>    I know that X.Org use Unix domain socket for IPC communication. There I can find the source code of the unix domain socket server? It is multithreaded?
> 
> Regards
> Peter
> 
> 
> 
> _______________________________________________
> xorg at lists.freedesktop.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.freedesktop.org/mailman/listinfo/xorg
> Your subscription address: martyj19 at comcast.net

If you are starting out with network programming, you might want to study a simpler example first.  There is so much else going on the X server that it would be difficult to follow.

The only thing from a programming perspective that is different about a Unix domain socket from a TCP socket is how you express its address.  In a TCP socket, you'd say 10.18.22.56:80 or www.yahoo.com:80 and then translate the domain name before you connect, and in a Unix domain socket, you'd say /var/run/pulse-socket because it is represented by a node in the file system.

I am thinking D-Bus would be a more straightforward example.  But really any good networking tutorial gives you everything but the little fragment of code that sets up the struct sockaddr.  A small HTTP server is a good example of something that handles many connections, if you want to look at how multithreading might be done.



More information about the xorg mailing list