yes, both sides can understand each other even if they are written in different languages, that's how come you could make a web browser in VB and have to get information from an apache server written in C...
anyway...
Unix sockets. (I'm really not explaining everything, just giving you some stuff to google).
Unix sockets are Berkley Sockets. it's a standard open model for socket programming, (and one that is not available in windows).
There is a very standard way to set up a socket, basically you open the socket and have the socket listen for connections.
when the socket recieves a connection it creates what is called a fork, a new socket is created, (at a higher port usually), and the server send s a reply through the first socket telling the client to open the higher socket, (usually above port 1024), and the server then sends replies to the higher end of the socket, whilst recieving requests on it's regular service port.
ports are threaded, (fork basically means a new processor thread), this is how a server can both listen for new requests, and process and reply requests at the same time.