title: How can I know the host name on client server program
body: <p>I am doing a program about client server communication using sockets. I saw examples of client server program on internet, but I have a question. How to get host name? I saw a client program example on the webpage int the link below. The program gets the host name from the user in command line arguments,but how can I know the host name? and I tried using my username on it but its says host does not found. I am running both on same machine. Thank you very much for your time.</p>
  
  <p>client:
  <a href="http://www.tutorialspoint.com/unix_sockets/socket_client_example.htm" rel="nofollow">http://www.tutorialspoint.com/unix_sockets/socket_client_example.htm</a></p>
  
  <p>server:
  <a href="http://www.tutorialspoint.com/unix_sockets/socket_server_example.htm" rel="nofollow">http://www.tutorialspoint.com/unix_sockets/socket_server_example.htm</a></p>