Hello World


A "hello world" program has become the traditional first program that many people learn. Here’s i’ll show you how to print "Hello World" in A web page.

Using HTML

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
   <HEAD>
      <TITLE>
         Hello World
      </TITLE>
   </HEAD>
<BODY>
   <P>hello world</P>
</BODY>
</HTML>

→ continue reading

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark


gethostbyname() vs getaddrinfo()

In IPv4 environment(usually) we used to call function gethostbyname() to do DNS lookups.then the information is load into a struct hostent.


#include <netdb.h>
struct hostent *gethostbyname(const char *name);

struct  hostent {
        char    *h_name;        /* official name of host */
        char    **h_aliases;    /* alias list */
        int     h_addrtype;     /* host address type */
        int     h_length;       /* length of address */
        char    **h_addr_list;  /* list of addresses from name server */
};
#define h_addr  h_addr_list[0]  /* address, for backward compatibility */

So, the easiest way to get information from gethostbyname() call is by extracting hostent structure.

→ continue reading

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark


Page 1 of 41234