title: How to use gethostbyname_r in linux
body: <p>I am currently using thread unsafe <strong>gethostbyname</strong> version which is very easy to use. You pass the hostname and it returns me the address structure. Looks like in MT environment, this version is crashing my application so trying to replace it with <strong>gethostbyname_r</strong>. Finding it very difficult to google a sample usage or any good documentation.</p>
  
  <p>Has anybody used this <strong>gethostbyname_r</strong> method ? any ideas ? How to use it and how to handle its error conditions if any.</p>