title: I run UNIX Network Programming Volume 1(3rd) but how to config the networking environment?
body: <p>I just run the "1.2 A Simple Daytime Client" sample. but under ubuntu, how to config the networking environment? </p>
  
  <p>THe sample usage is "solaris % a.out 206.168.112.96", here how should i change the IP here.  I am connect to Internet by a LAN. my ip showing by ifconfig is </p>
  
  <p><code>inet address: 192.168.0.109</code>, but here when i type <code>a.out 192.168.0.109</code>, it give a info that "connect error: Connection refused", how should i do?</p>
  
  <p>Attached is this sample code:</p>
  
  <h3>intro/daytimetcpcli.c</h3>
  
  <pre><code>  #include  "unp.h"
  
    int
    main(int argc, char **argv)
    {
        int     sockfd, n;
        char    recvline[MAXLINE + 1];
        struct sockaddr_in servaddr;
  
        if (argc != 2)
            err_quit("usage: a.out &lt;IPaddress&gt;");
  
       if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) &lt; 0)
           err_sys("socket error");
  
       bzero(&amp;servaddr, sizeof(servaddr));
       servaddr.sin_family = AF_INET;
       servaddr.sin_port = htons(13);  /* daytime server */
       if (inet_pton(AF_INET, argv[1], &amp;servaddr.sin_addr) &lt;= 0)
           err_quit("inet_pton error for %s", argv[1]);
  
       if (connect(sockfd, (SA *) &amp;servaddr, sizeof(servaddr)) &lt; 0)
           err_sys("connect error");
  
       while ( (n = read(sockfd, recvline, MAXLINE)) &gt; 0) {
           recvline[n] = 0;        /* null terminate */
           if (fputs(recvline, stdout) == EOF)
               err_sys("fputs error");
       }
       if (n &lt; 0)
           err_sys("read error");
  
       exit(0);
   }
  </code></pre>
  
  <p>Anyone give any advice, i am new to networking progarmming.</p>
  
  <p>I just run as one answer provided here:</p>
  
  <pre><code>root@ubuntu:/home/jack/dev/practice# ./daytimetcpcli 192.168.0.109
  connect error: Connection refused
  root@ubuntu:/home/jack/dev/practice# 
  </code></pre>
  
  <p>it still give the connect error info:</p>
  
  <p>I use the netstat to check info.</p>
  
  <pre><code>  jack@ubuntu:~$ sudo netstat -tlp
  
    activate Internet connection (just server)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 localhost:5038          *:*                     LISTEN      1625/asterisk   
    tcp        0      0 *:cisco-sccp            *:*                     LISTEN      1625/asterisk   
    tcp        0      0 *:http                  *:*                     LISTEN      1679/apache2    
    tcp        0      0 localhost:domain        *:*                     LISTEN      1405/dnsmasq    
    tcp        0      0 localhost:ipp           *:*                     LISTEN      933/cupsd       
    tcp        0      0 localhost:postgresql    *:*                     LISTEN      1076/postgres   
    tcp        0      0 localhost:5946          *:*                     LISTEN      983/teamviewerd 
    tcp        0      0 *:sip                   *:*                     LISTEN      1625/asterisk   
    tcp6       0      0 ip6-localhost:ipp       [::]:*                  LISTEN      933/cupsd       
  </code></pre>