# FQDN and getdomainname

**URL:** <https://community.unix.com/t/fqdn-and-getdomainname/157472>\
**Category:** Programming\
**Created:** [November 15, 2005, 12:53am UTC](https://community.unix.com/t/fqdn-and-getdomainname/157472 "2005-11-15T00:53:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NanoSec](https://community.unix.com/letter_avatar/nanosec/32/6_22734026db12803ebb3e059622ac3534.png) [@NanoSec](https://community.unix.com/u/NanoSec)\
**Post date:** [November 15, 2005, 12:53am UTC](https://community.unix.com/t/fqdn-and-getdomainname/157472/1 "2005-11-15T00:53:49Z")

</div>

I have a need to create a connection between an erlang node and my C program.  
the name of an erlang node looks something like monitor@host1.ipc.co.za.  
The piece of code I have to construct a node name looks like this:

char \*hostname, \*domainname, \*nodename = "monitor", \*thisfullnodename;

//Aaahhhhh. Me \*little\* handler for dose nasty segments  
signal( SIGSEGV, (void \*)cleanup );

gethostname( hostname, 31 );  
getdomainname( domainname, 31 );  
strncat( thisfullnodename, nodename, strlen(nodename) );  
strncat( thisfullnodename, "@", 1 );  
strncat( thisfullnodename, hostname, strlen(hostname) );  
strncat( thisfullnodename, domainname, strlen(domainname) );

puts( thisfullnodename );

The puts statement at the end should print monitor@host1.ipc.co.za, but it doesn't it only prints monitor@host1.

Any thoughts ? Ideas ? Help ?

---

<div class="post-metadata">

**Author:** ![NanoSec](https://community.unix.com/letter_avatar/nanosec/32/6_22734026db12803ebb3e059622ac3534.png) [@NanoSec](https://community.unix.com/u/NanoSec)\
**Post date:** [November 15, 2005, 4:27am UTC](https://community.unix.com/t/fqdn-and-getdomainname/157472/2 "2005-11-15T04:27:17Z")

</div>

Don't worry. Problem solved
