SRV records are step in the right direction. However, there's much more to it. On LAN, for example, you want the services to be registered and discovered dynamically, rather than inserted by hand into DNS (think DNS-SD) Also, I guess, some kind of scoping is needed (local service with same name shadows the global service) Etc.
Once the following works out of the box on LAN, we're pretty close:
s1 = socket (AF_INET, SOCK_STREAM, 0);
bind (s1, "myApplication1");
...
s2 = socket (AF_INET, SOCK_STREAM, 0);
connect (s2, "myApplication1");